<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP, NondecreasingIndentation, TupleSections, RecordWildCards #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-comment">--</span><span>
</span><span id="line-5"></span><span class="hs-comment">--  (c) The University of Glasgow 2002-2006</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- | The dynamic linker for GHCi.</span><span>
</span><span id="line-8"></span><span class="hs-comment">--</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- This module deals with the top-level issues of dynamic linking,</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- calling the object-code linker and the byte-code linker where</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- necessary.</span><span>
</span><span id="line-12"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Runtime.Linker</span><span>
</span><span id="line-13"></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#getHValue"><span class="hs-identifier">getHValue</span></a></span><span>
</span><span id="line-14"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#showLinkerState"><span class="hs-identifier">showLinkerState</span></a></span><span>
</span><span id="line-15"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#linkExpr"><span class="hs-identifier">linkExpr</span></a></span><span>
</span><span id="line-16"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#linkDecls"><span class="hs-identifier">linkDecls</span></a></span><span>
</span><span id="line-17"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#unload"><span class="hs-identifier">unload</span></a></span><span>
</span><span id="line-18"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#withExtendedLinkEnv"><span class="hs-identifier">withExtendedLinkEnv</span></a></span><span>
</span><span id="line-19"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#extendLinkEnv"><span class="hs-identifier">extendLinkEnv</span></a></span><span>
</span><span id="line-20"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#deleteFromLinkEnv"><span class="hs-identifier">deleteFromLinkEnv</span></a></span><span>
</span><span id="line-21"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#extendLoadedPkgs"><span class="hs-identifier">extendLoadedPkgs</span></a></span><span>
</span><span id="line-22"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#linkPackages"><span class="hs-identifier">linkPackages</span></a></span><span>
</span><span id="line-23"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#initDynLinker"><span class="hs-identifier">initDynLinker</span></a></span><span>
</span><span id="line-24"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#linkModule"><span class="hs-identifier">linkModule</span></a></span><span>
</span><span id="line-25"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#linkCmdLineLibs"><span class="hs-identifier">linkCmdLineLibs</span></a></span><span>
</span><span id="line-26"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#uninitializedLinker"><span class="hs-identifier">uninitializedLinker</span></a></span><span>
</span><span id="line-27"></span><span>   </span><span class="hs-special">)</span><span>
</span><span id="line-28"></span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.html"><span class="hs-identifier">GHC.Runtime.Interpreter</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html"><span class="hs-identifier">GHC.Runtime.Interpreter.Types</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#"><span class="hs-identifier">GHCi.RemoteTypes</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Load.html"><span class="hs-identifier">GHC.Iface.Load</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.ByteCode.Linker.html"><span class="hs-identifier">GHC.ByteCode.Linker</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.ByteCode.Asm.html"><span class="hs-identifier">GHC.ByteCode.Asm</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.ByteCode.Types.html"><span class="hs-identifier">GHC.ByteCode.Types</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.State.html"><span class="hs-identifier">GHC.Unit.State</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Packages</span></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Phases.html"><span class="hs-identifier">GHC.Driver.Phases</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Finder.html"><span class="hs-identifier">GHC.Driver.Finder</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Ways.html"><span class="hs-identifier">GHC.Driver.Ways</span></a></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html"><span class="hs-identifier">GHC.Types.Name.Env</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.List.SetOps.html"><span class="hs-identifier">GHC.Data.List.SetOps</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html"><span class="hs-identifier">GHC.Runtime.Linker.Types</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier">DynLinker</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier">PersistentLinkerState</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html"><span class="hs-identifier">GHC.Utils.Panic</span></a></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html"><span class="hs-identifier">GHC.Data.Maybe</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Maybes</span></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.DSet.html"><span class="hs-identifier">GHC.Types.Unique.DSet</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.SysTools.html"><span class="hs-identifier">GHC.SysTools</span></a></span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.SysTools.FileCleanup.html"><span class="hs-identifier">GHC.SysTools.FileCleanup</span></a></span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span class="hs-comment">-- Standard libraries</span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.Set.html#"><span class="hs-identifier">Data.Set</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Set</span></span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Char.html#"><span class="hs-identifier">Data.Char</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier">isSpace</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Function.html#"><span class="hs-identifier">Data.Function</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Function.html#%26"><span class="hs-operator">(&amp;)</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.IORef.html#"><span class="hs-identifier">Data.IORef</span></a></span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#intercalate"><span class="hs-identifier">intercalate</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#isPrefixOf"><span class="hs-identifier">isPrefixOf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#isSuffixOf"><span class="hs-identifier">isSuffixOf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#nub"><span class="hs-identifier">nub</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier">partition</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-74"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span>
</span><span id="line-75"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Concurrent.MVar.html#"><span class="hs-identifier">Control.Concurrent.MVar</span></a></span><span>
</span><span id="line-76"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../exceptions/src/Control.Monad.Catch.html#"><span class="hs-identifier">Control.Monad.Catch</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">MC</span></span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.html#"><span class="hs-identifier">System.FilePath</span></a></span><span>
</span><span id="line-79"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../directory/src/System.Directory.html#"><span class="hs-identifier">System.Directory</span></a></span><span>
</span><span id="line-80"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Unsafe.html#"><span class="hs-identifier">System.IO.Unsafe</span></a></span><span>
</span><span id="line-81"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.Environment.html#"><span class="hs-identifier">System.Environment</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/System.Environment.html#lookupEnv"><span class="hs-identifier">lookupEnv</span></a></span><span class="hs-special">)</span><span class="hs-cpp">

#if defined(mingw32_HOST_OS)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../Win32/src/System.Win32.Info.html#"><span class="hs-identifier">System.Win32.Info</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../Win32/src/System.Win32.Info.html#getSystemDirectory"><span class="hs-identifier">getSystemDirectory</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-87"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Exception.html"><span class="hs-identifier">GHC.Utils.Exception</span></a></span><span>
</span><span id="line-88"></span><span>
</span><span id="line-89"></span><span class="hs-comment">{- **********************************************************************

                        The Linker's state

  ********************************************************************* -}</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span class="hs-comment">{-
The persistent linker state *must* match the actual state of the
C dynamic linker at all times.

The MVar used to hold the PersistentLinkerState contains a Maybe
PersistentLinkerState. The MVar serves to ensure mutual exclusion between
multiple loaded copies of the GHC library. The Maybe may be Nothing to
indicate that the linker has not yet been initialised.

The PersistentLinkerState maps Names to actual closures (for
interpreted code only), for use during linking.
-}</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="annot"><a href="GHC.Runtime.Linker.html#uninitializedLinker"><span class="hs-identifier hs-type">uninitializedLinker</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-type">DynLinker</span></a></span><span>
</span><span id="line-109"></span><span id="uninitializedLinker"><span class="annot"><span class="annottext">uninitializedLinker :: IO DynLinker
</span><a href="GHC.Runtime.Linker.html#uninitializedLinker"><span class="hs-identifier hs-var hs-var">uninitializedLinker</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-110"></span><span>  </span><span class="annot"><span class="annottext">Maybe PersistentLinkerState
-&gt; IO (MVar (Maybe PersistentLinkerState))
forall a. a -&gt; IO (MVar a)
</span><a href="../../base/src/GHC.MVar.html#newMVar"><span class="hs-identifier hs-var">newMVar</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe PersistentLinkerState
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">IO (MVar (Maybe PersistentLinkerState))
-&gt; (MVar (Maybe PersistentLinkerState) -&gt; IO DynLinker)
-&gt; IO DynLinker
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynLinker -&gt; IO DynLinker
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(DynLinker -&gt; IO DynLinker)
-&gt; (MVar (Maybe PersistentLinkerState) -&gt; DynLinker)
-&gt; MVar (Maybe PersistentLinkerState)
-&gt; IO DynLinker
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">MVar (Maybe PersistentLinkerState) -&gt; DynLinker
</span><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-var">DynLinker</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span id="local-6989586621681180640"><span class="annot"><a href="GHC.Runtime.Linker.html#uninitialised"><span class="hs-identifier hs-type">uninitialised</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621681180640"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-113"></span><span id="uninitialised"><span class="annot"><span class="annottext">uninitialised :: forall a. a
</span><a href="GHC.Runtime.Linker.html#uninitialised"><span class="hs-identifier hs-var hs-var">uninitialised</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Dynamic linker not initialised&quot;</span></span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span class="annot"><a href="GHC.Runtime.Linker.html#modifyPLS_"><span class="hs-identifier hs-type">modifyPLS_</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-type">DynLinker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-116"></span><span id="modifyPLS_"><span class="annot"><span class="annottext">modifyPLS_ :: DynLinker
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#modifyPLS_"><span class="hs-identifier hs-var hs-var">modifyPLS_</span></a></span></span><span> </span><span id="local-6989586621681180063"><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180063"><span class="hs-identifier hs-var">dl</span></a></span></span><span> </span><span id="local-6989586621681180062"><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="#local-6989586621681180062"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-117"></span><span>  </span><span class="annot"><span class="annottext">MVar (Maybe PersistentLinkerState)
-&gt; (Maybe PersistentLinkerState
    -&gt; IO (Maybe PersistentLinkerState))
-&gt; IO ()
forall a. MVar a -&gt; (a -&gt; IO a) -&gt; IO ()
</span><a href="../../base/src/Control.Concurrent.MVar.html#modifyMVar_"><span class="hs-identifier hs-var">modifyMVar_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynLinker -&gt; MVar (Maybe PersistentLinkerState)
</span><a href="GHC.Runtime.Linker.Types.html#dl_mpls"><span class="hs-identifier hs-var hs-var">dl_mpls</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180063"><span class="hs-identifier hs-var">dl</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(PersistentLinkerState -&gt; Maybe PersistentLinkerState)
-&gt; IO PersistentLinkerState -&gt; IO (Maybe PersistentLinkerState)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; Maybe PersistentLinkerState
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(IO PersistentLinkerState -&gt; IO (Maybe PersistentLinkerState))
-&gt; (Maybe PersistentLinkerState -&gt; IO PersistentLinkerState)
-&gt; Maybe PersistentLinkerState
-&gt; IO (Maybe PersistentLinkerState)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="#local-6989586621681180062"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(PersistentLinkerState -&gt; IO PersistentLinkerState)
-&gt; (Maybe PersistentLinkerState -&gt; PersistentLinkerState)
-&gt; Maybe PersistentLinkerState
-&gt; IO PersistentLinkerState
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
-&gt; Maybe PersistentLinkerState -&gt; PersistentLinkerState
forall a. a -&gt; Maybe a -&gt; a
</span><a href="../../base/src/Data.Maybe.html#fromMaybe"><span class="hs-identifier hs-var">fromMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
forall a. a
</span><a href="GHC.Runtime.Linker.html#uninitialised"><span class="hs-identifier hs-var">uninitialised</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span id="local-6989586621681180632"><span class="annot"><a href="GHC.Runtime.Linker.html#modifyPLS"><span class="hs-identifier hs-type">modifyPLS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-type">DynLinker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681180632"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621681180632"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-120"></span><span id="modifyPLS"><span class="annot"><span class="annottext">modifyPLS :: forall a.
DynLinker
-&gt; (PersistentLinkerState -&gt; IO (PersistentLinkerState, a)) -&gt; IO a
</span><a href="GHC.Runtime.Linker.html#modifyPLS"><span class="hs-identifier hs-var hs-var">modifyPLS</span></a></span></span><span> </span><span id="local-6989586621681180055"><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180055"><span class="hs-identifier hs-var">dl</span></a></span></span><span> </span><span id="local-6989586621681180054"><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO (PersistentLinkerState, a)
</span><a href="#local-6989586621681180054"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-121"></span><span>  </span><span class="annot"><span class="annottext">MVar (Maybe PersistentLinkerState)
-&gt; (Maybe PersistentLinkerState
    -&gt; IO (Maybe PersistentLinkerState, a))
-&gt; IO a
forall a b. MVar a -&gt; (a -&gt; IO (a, b)) -&gt; IO b
</span><a href="../../base/src/Control.Concurrent.MVar.html#modifyMVar"><span class="hs-identifier hs-var">modifyMVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynLinker -&gt; MVar (Maybe PersistentLinkerState)
</span><a href="GHC.Runtime.Linker.Types.html#dl_mpls"><span class="hs-identifier hs-var hs-var">dl_mpls</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180055"><span class="hs-identifier hs-var">dl</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(PersistentLinkerState -&gt; Maybe PersistentLinkerState)
-&gt; IO (PersistentLinkerState, a)
-&gt; IO (Maybe PersistentLinkerState, a)
forall {f :: * -&gt; *} {t} {a} {b}.
Functor f =&gt;
(t -&gt; a) -&gt; f (t, b) -&gt; f (a, b)
</span><a href="#local-6989586621681180052"><span class="hs-identifier hs-var">fmapFst</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; Maybe PersistentLinkerState
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (PersistentLinkerState, a)
 -&gt; IO (Maybe PersistentLinkerState, a))
-&gt; (Maybe PersistentLinkerState -&gt; IO (PersistentLinkerState, a))
-&gt; Maybe PersistentLinkerState
-&gt; IO (Maybe PersistentLinkerState, a)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO (PersistentLinkerState, a)
</span><a href="#local-6989586621681180054"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(PersistentLinkerState -&gt; IO (PersistentLinkerState, a))
-&gt; (Maybe PersistentLinkerState -&gt; PersistentLinkerState)
-&gt; Maybe PersistentLinkerState
-&gt; IO (PersistentLinkerState, a)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
-&gt; Maybe PersistentLinkerState -&gt; PersistentLinkerState
forall a. a -&gt; Maybe a -&gt; a
</span><a href="../../base/src/Data.Maybe.html#fromMaybe"><span class="hs-identifier hs-var">fromMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
forall a. a
</span><a href="GHC.Runtime.Linker.html#uninitialised"><span class="hs-identifier hs-var">uninitialised</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-122"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681180052"><span class="annot"><span class="annottext">fmapFst :: (t -&gt; a) -&gt; f (t, b) -&gt; f (a, b)
</span><a href="#local-6989586621681180052"><span class="hs-identifier hs-var hs-var">fmapFst</span></a></span></span><span> </span><span id="local-6989586621681180049"><span class="annot"><span class="annottext">t -&gt; a
</span><a href="#local-6989586621681180049"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((t, b) -&gt; (a, b)) -&gt; f (t, b) -&gt; f (a, b)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621681180048"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621681180048"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681180047"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681180047"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t -&gt; a
</span><a href="#local-6989586621681180049"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621681180048"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681180047"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span class="annot"><a href="GHC.Runtime.Linker.html#readPLS"><span class="hs-identifier hs-type">readPLS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-type">DynLinker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-125"></span><span id="readPLS"><span class="annot"><span class="annottext">readPLS :: DynLinker -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#readPLS"><span class="hs-identifier hs-var hs-var">readPLS</span></a></span></span><span> </span><span id="local-6989586621681180045"><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180045"><span class="hs-identifier hs-var">dl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-126"></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Maybe PersistentLinkerState -&gt; PersistentLinkerState)
-&gt; IO (Maybe PersistentLinkerState) -&gt; IO PersistentLinkerState
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
-&gt; Maybe PersistentLinkerState -&gt; PersistentLinkerState
forall a. a -&gt; Maybe a -&gt; a
</span><a href="../../base/src/Data.Maybe.html#fromMaybe"><span class="hs-identifier hs-var">fromMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
forall a. a
</span><a href="GHC.Runtime.Linker.html#uninitialised"><span class="hs-identifier hs-var">uninitialised</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO (Maybe PersistentLinkerState) -&gt; IO PersistentLinkerState)
-&gt; (MVar (Maybe PersistentLinkerState)
    -&gt; IO (Maybe PersistentLinkerState))
-&gt; MVar (Maybe PersistentLinkerState)
-&gt; IO PersistentLinkerState
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">MVar (Maybe PersistentLinkerState)
-&gt; IO (Maybe PersistentLinkerState)
forall a. MVar a -&gt; IO a
</span><a href="../../base/src/GHC.MVar.html#readMVar"><span class="hs-identifier hs-var">readMVar</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynLinker -&gt; MVar (Maybe PersistentLinkerState)
</span><a href="GHC.Runtime.Linker.Types.html#dl_mpls"><span class="hs-identifier hs-var hs-var">dl_mpls</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180045"><span class="hs-identifier hs-var">dl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span class="annot"><a href="GHC.Runtime.Linker.html#modifyMbPLS_"><span class="hs-identifier hs-type">modifyMbPLS_</span></a></span><span>
</span><span id="line-129"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-type">DynLinker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-130"></span><span id="modifyMbPLS_"><span class="annot"><span class="annottext">modifyMbPLS_ :: DynLinker
-&gt; (Maybe PersistentLinkerState
    -&gt; IO (Maybe PersistentLinkerState))
-&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#modifyMbPLS_"><span class="hs-identifier hs-var hs-var">modifyMbPLS_</span></a></span></span><span> </span><span id="local-6989586621681180042"><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180042"><span class="hs-identifier hs-var">dl</span></a></span></span><span> </span><span id="local-6989586621681180041"><span class="annot"><span class="annottext">Maybe PersistentLinkerState -&gt; IO (Maybe PersistentLinkerState)
</span><a href="#local-6989586621681180041"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MVar (Maybe PersistentLinkerState)
-&gt; (Maybe PersistentLinkerState
    -&gt; IO (Maybe PersistentLinkerState))
-&gt; IO ()
forall a. MVar a -&gt; (a -&gt; IO a) -&gt; IO ()
</span><a href="../../base/src/Control.Concurrent.MVar.html#modifyMVar_"><span class="hs-identifier hs-var">modifyMVar_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynLinker -&gt; MVar (Maybe PersistentLinkerState)
</span><a href="GHC.Runtime.Linker.Types.html#dl_mpls"><span class="hs-identifier hs-var hs-var">dl_mpls</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180042"><span class="hs-identifier hs-var">dl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe PersistentLinkerState -&gt; IO (Maybe PersistentLinkerState)
</span><a href="#local-6989586621681180041"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span class="annot"><a href="GHC.Runtime.Linker.html#emptyPLS"><span class="hs-identifier hs-type">emptyPLS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-133"></span><span id="emptyPLS"><span class="annot"><span class="annottext">emptyPLS :: PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#emptyPLS"><span class="hs-identifier hs-var hs-var">emptyPLS</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState :: ClosureEnv
-&gt; ItblEnv
-&gt; [Linkable]
-&gt; [Linkable]
-&gt; [UnitId]
-&gt; [(String, String)]
-&gt; PersistentLinkerState
</span><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-134"></span><span>   </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">closure_env :: ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var">closure_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureEnv
forall a. NameEnv a
</span><a href="GHC.Types.Name.Env.html#emptyNameEnv"><span class="hs-identifier hs-var">emptyNameEnv</span></a></span><span>
</span><span id="line-135"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">itbl_env :: ItblEnv
</span><a href="GHC.Runtime.Linker.Types.html#itbl_env"><span class="hs-identifier hs-var">itbl_env</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ItblEnv
forall a. NameEnv a
</span><a href="GHC.Types.Name.Env.html#emptyNameEnv"><span class="hs-identifier hs-var">emptyNameEnv</span></a></span><span>
</span><span id="line-136"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pkgs_loaded :: [UnitId]
</span><a href="GHC.Runtime.Linker.Types.html#pkgs_loaded"><span class="hs-identifier hs-var">pkgs_loaded</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681180034"><span class="hs-identifier hs-var">init_pkgs</span></a></span><span>
</span><span id="line-137"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bcos_loaded :: [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#bcos_loaded"><span class="hs-identifier hs-var">bcos_loaded</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-138"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">objs_loaded :: [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#objs_loaded"><span class="hs-identifier hs-var">objs_loaded</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-139"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">temp_sos :: [(String, String)]
</span><a href="GHC.Runtime.Linker.Types.html#temp_sos"><span class="hs-identifier hs-var">temp_sos</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-140"></span><span>   </span><span class="hs-special">}</span><span>
</span><span id="line-141"></span><span>  </span><span class="hs-comment">-- Packages that don't need loading, because the compiler</span><span>
</span><span id="line-142"></span><span>  </span><span class="hs-comment">-- shares them with the interpreted program.</span><span>
</span><span id="line-143"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-144"></span><span>  </span><span class="hs-comment">-- The linker's symbol table is populated with RTS symbols using an</span><span>
</span><span id="line-145"></span><span>  </span><span class="hs-comment">-- explicit list.  See rts/Linker.c for details.</span><span>
</span><span id="line-146"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681180034"><span class="annot"><span class="annottext">init_pkgs :: [UnitId]
</span><a href="#local-6989586621681180034"><span class="hs-identifier hs-var hs-var">init_pkgs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">UnitId
</span><a href="GHC.Unit.Types.html#rtsUnitId"><span class="hs-identifier hs-var">rtsUnitId</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span class="annot"><a href="GHC.Runtime.Linker.html#extendLoadedPkgs"><span class="hs-identifier hs-type">extendLoadedPkgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-type">DynLinker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-149"></span><span id="extendLoadedPkgs"><span class="annot"><span class="annottext">extendLoadedPkgs :: DynLinker -&gt; [UnitId] -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#extendLoadedPkgs"><span class="hs-identifier hs-var hs-var">extendLoadedPkgs</span></a></span></span><span> </span><span id="local-6989586621681180029"><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180029"><span class="hs-identifier hs-var">dl</span></a></span></span><span> </span><span id="local-6989586621681180028"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681180028"><span class="hs-identifier hs-var">pkgs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-150"></span><span>  </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#modifyPLS_"><span class="hs-identifier hs-var">modifyPLS_</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180029"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ())
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681180027"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180027"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-151"></span><span>      </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180027"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pkgs_loaded :: [UnitId]
</span><a href="GHC.Runtime.Linker.Types.html#pkgs_loaded"><span class="hs-identifier hs-var">pkgs_loaded</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681180028"><span class="hs-identifier hs-var">pkgs</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId] -&gt; [UnitId] -&gt; [UnitId]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [UnitId]
</span><a href="GHC.Runtime.Linker.Types.html#pkgs_loaded"><span class="hs-identifier hs-var hs-var">pkgs_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180027"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span class="annot"><a href="GHC.Runtime.Linker.html#extendLinkEnv"><span class="hs-identifier hs-type">extendLinkEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-type">DynLinker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#ForeignHValue"><span class="hs-identifier hs-type">ForeignHValue</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-154"></span><span id="extendLinkEnv"><span class="annot"><span class="annottext">extendLinkEnv :: DynLinker -&gt; [(Name, ForeignHValue)] -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#extendLinkEnv"><span class="hs-identifier hs-var hs-var">extendLinkEnv</span></a></span></span><span> </span><span id="local-6989586621681180026"><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180026"><span class="hs-identifier hs-var">dl</span></a></span></span><span> </span><span id="local-6989586621681180025"><span class="annot"><span class="annottext">[(Name, ForeignHValue)]
</span><a href="#local-6989586621681180025"><span class="hs-identifier hs-var">new_bindings</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-155"></span><span>  </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#modifyPLS_"><span class="hs-identifier hs-var">modifyPLS_</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180026"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ())
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681180024"><span class="annot"><span class="annottext">pls :: PersistentLinkerState
</span><a href="#local-6989586621681180024"><span class="hs-identifier hs-var">pls</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span class="hs-special">{</span><span id="local-6989586621681180018"><span id="local-6989586621681180019"><span id="local-6989586621681180020"><span id="local-6989586621681180021"><span id="local-6989586621681180022"><span id="local-6989586621681180023"><span class="annot"><span class="annottext">[(String, String)]
[UnitId]
[Linkable]
ClosureEnv
ItblEnv
temp_sos :: [(String, String)]
pkgs_loaded :: [UnitId]
objs_loaded :: [Linkable]
bcos_loaded :: [Linkable]
itbl_env :: ItblEnv
closure_env :: ClosureEnv
temp_sos :: PersistentLinkerState -&gt; [(String, String)]
objs_loaded :: PersistentLinkerState -&gt; [Linkable]
bcos_loaded :: PersistentLinkerState -&gt; [Linkable]
pkgs_loaded :: PersistentLinkerState -&gt; [UnitId]
itbl_env :: PersistentLinkerState -&gt; ItblEnv
closure_env :: PersistentLinkerState -&gt; ClosureEnv
</span><a href="#local-6989586621681180018"><span class="hs-glyph hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">..</span></a></span></span></span></span></span></span></span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681180017"><span class="annot"><span class="annottext">new_ce :: ClosureEnv
</span><a href="#local-6989586621681180017"><span class="hs-identifier hs-var hs-var">new_ce</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureEnv -&gt; [(Name, ForeignHValue)] -&gt; ClosureEnv
</span><a href="GHC.ByteCode.Linker.html#extendClosureEnv"><span class="hs-identifier hs-var">extendClosureEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681180023"><span class="hs-identifier hs-var">closure_env</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, ForeignHValue)]
</span><a href="#local-6989586621681180025"><span class="hs-identifier hs-var">new_bindings</span></a></span><span>
</span><span id="line-157"></span><span>    </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(PersistentLinkerState -&gt; IO PersistentLinkerState)
-&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180024"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">closure_env :: ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var">closure_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681180017"><span class="hs-identifier hs-var">new_ce</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-158"></span><span>    </span><span class="hs-comment">-- strictness is important for not retaining old copies of the pls</span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span class="annot"><a href="GHC.Runtime.Linker.html#deleteFromLinkEnv"><span class="hs-identifier hs-type">deleteFromLinkEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-type">DynLinker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-161"></span><span id="deleteFromLinkEnv"><span class="annot"><span class="annottext">deleteFromLinkEnv :: DynLinker -&gt; [Name] -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#deleteFromLinkEnv"><span class="hs-identifier hs-var hs-var">deleteFromLinkEnv</span></a></span></span><span> </span><span id="local-6989586621681180014"><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180014"><span class="hs-identifier hs-var">dl</span></a></span></span><span> </span><span id="local-6989586621681180013"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681180013"><span class="hs-identifier hs-var">to_remove</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-162"></span><span>  </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#modifyPLS_"><span class="hs-identifier hs-var">modifyPLS_</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180014"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ())
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681180012"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180012"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-163"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681180011"><span class="annot"><span class="annottext">ce :: ClosureEnv
</span><a href="#local-6989586621681180011"><span class="hs-identifier hs-var hs-var">ce</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var hs-var">closure_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180012"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-164"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681180010"><span class="annot"><span class="annottext">new_ce :: ClosureEnv
</span><a href="#local-6989586621681180010"><span class="hs-identifier hs-var hs-var">new_ce</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureEnv -&gt; [Name] -&gt; ClosureEnv
forall a. NameEnv a -&gt; [Name] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#delListFromNameEnv"><span class="hs-identifier hs-var">delListFromNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681180011"><span class="hs-identifier hs-var">ce</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681180013"><span class="hs-identifier hs-var">to_remove</span></a></span><span>
</span><span id="line-165"></span><span>    </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180012"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">closure_env :: ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var">closure_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681180010"><span class="hs-identifier hs-var">new_ce</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span class="hs-comment">-- | Get the 'HValue' associated with the given name.</span><span>
</span><span id="line-168"></span><span class="hs-comment">--</span><span>
</span><span id="line-169"></span><span class="hs-comment">-- May cause loading the module that contains the name.</span><span>
</span><span id="line-170"></span><span class="hs-comment">--</span><span>
</span><span id="line-171"></span><span class="hs-comment">-- Throws a 'ProgramError' if loading fails or the name cannot be found.</span><span>
</span><span id="line-172"></span><span class="annot"><a href="GHC.Runtime.Linker.html#getHValue"><span class="hs-identifier hs-type">getHValue</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#ForeignHValue"><span class="hs-identifier hs-type">ForeignHValue</span></a></span><span>
</span><span id="line-173"></span><span id="getHValue"><span class="annot"><span class="annottext">getHValue :: HscEnv -&gt; Name -&gt; IO ForeignHValue
</span><a href="GHC.Runtime.Linker.html#getHValue"><span class="hs-identifier hs-var hs-var">getHValue</span></a></span></span><span> </span><span id="local-6989586621681180008"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681180008"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681180007"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681180007"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-174"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681180006"><span class="annot"><span class="annottext">dl :: DynLinker
</span><a href="#local-6989586621681180006"><span class="hs-identifier hs-var hs-var">dl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynLinker
</span><a href="GHC.Driver.Types.html#hsc_dynLinker"><span class="hs-identifier hs-var hs-var">hsc_dynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681180008"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-175"></span><span>  </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#initDynLinker"><span class="hs-identifier hs-var">initDynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681180008"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-176"></span><span>  </span><span id="local-6989586621681180004"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180004"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState
    -&gt; IO (PersistentLinkerState, PersistentLinkerState))
-&gt; IO PersistentLinkerState
forall a.
DynLinker
-&gt; (PersistentLinkerState -&gt; IO (PersistentLinkerState, a)) -&gt; IO a
</span><a href="GHC.Runtime.Linker.html#modifyPLS"><span class="hs-identifier hs-var">modifyPLS</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681180006"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState
  -&gt; IO (PersistentLinkerState, PersistentLinkerState))
 -&gt; IO PersistentLinkerState)
-&gt; (PersistentLinkerState
    -&gt; IO (PersistentLinkerState, PersistentLinkerState))
-&gt; IO PersistentLinkerState
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681180003"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180003"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-177"></span><span>           </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isExternalName"><span class="hs-identifier hs-var">isExternalName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681180007"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-178"></span><span>             </span><span class="hs-special">(</span><span id="local-6989586621681180001"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180001"><span class="hs-identifier hs-var">pls'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681180000"><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681180000"><span class="hs-identifier hs-var">ok</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; PersistentLinkerState
-&gt; SrcSpan
-&gt; [Module]
-&gt; IO (PersistentLinkerState, SuccessFlag)
</span><a href="GHC.Runtime.Linker.html#linkDependencies"><span class="hs-identifier hs-var">linkDependencies</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681180008"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180003"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier hs-var">noSrcSpan</span></a></span><span>
</span><span id="line-179"></span><span>                              </span><span class="hs-special">[</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Module
Name -&gt; Module
</span><a href="GHC.Types.Name.html#nameModule"><span class="hs-identifier hs-var">nameModule</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681180007"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-180"></span><span>             </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SuccessFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#failed"><span class="hs-identifier hs-var">failed</span></a></span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681180000"><span class="hs-identifier hs-var">ok</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO (PersistentLinkerState, PersistentLinkerState)
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-181"></span><span>                            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">(PersistentLinkerState, PersistentLinkerState)
-&gt; IO (PersistentLinkerState, PersistentLinkerState)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180001"><span class="hs-identifier hs-var">pls'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180001"><span class="hs-identifier hs-var">pls'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-182"></span><span>            </span><span class="hs-keyword">else</span><span>
</span><span id="line-183"></span><span>             </span><span class="annot"><span class="annottext">(PersistentLinkerState, PersistentLinkerState)
-&gt; IO (PersistentLinkerState, PersistentLinkerState)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180003"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180003"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-184"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ClosureEnv -&gt; Name -&gt; Maybe (Name, ForeignHValue)
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var hs-var">closure_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681180004"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681180007"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-185"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621681179992"><span class="annot"><span class="annottext">ForeignHValue
</span><a href="#local-6989586621681179992"><span class="hs-identifier hs-var">aa</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ForeignHValue -&gt; IO ForeignHValue
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignHValue
</span><a href="#local-6989586621681179992"><span class="hs-identifier hs-var">aa</span></a></span><span>
</span><span id="line-186"></span><span>    </span><span class="annot"><span class="annottext">Maybe (Name, ForeignHValue)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-187"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span class="hs-identifier">isExternalName</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">)</span><span>
</span><span id="line-188"></span><span>           </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179986"><span class="annot"><span class="annottext">sym_to_find :: FastString
</span><a href="#local-6989586621681179986"><span class="hs-identifier hs-var hs-var">sym_to_find</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; String -&gt; FastString
</span><a href="GHC.ByteCode.Linker.html#nameToCLabel"><span class="hs-identifier hs-var">nameToCLabel</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681180007"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;closure&quot;</span></span><span>
</span><span id="line-189"></span><span>              </span><span id="local-6989586621681179984"><span class="annot"><span class="annottext">Maybe HValueRef
</span><a href="#local-6989586621681179984"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO (Maybe HValueRef)
</span><a href="GHC.Runtime.Interpreter.html#lookupClosure"><span class="hs-identifier hs-var">lookupClosure</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681180008"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; String
</span><a href="GHC.Data.FastString.html#unpackFS"><span class="hs-identifier hs-var">unpackFS</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681179986"><span class="hs-identifier hs-var">sym_to_find</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-190"></span><span>              </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe HValueRef
</span><a href="#local-6989586621681179984"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-191"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179981"><span class="annot"><span class="annottext">HValueRef
</span><a href="#local-6989586621681179981"><span class="hs-identifier hs-var">hvref</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; HValueRef -&gt; IO ForeignHValue
forall a. HscEnv -&gt; RemoteRef a -&gt; IO (ForeignRef a)
</span><a href="GHC.Runtime.Interpreter.html#mkFinalizedHValue"><span class="hs-identifier hs-var">mkFinalizedHValue</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681180008"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">HValueRef
</span><a href="#local-6989586621681179981"><span class="hs-identifier hs-var">hvref</span></a></span><span>
</span><span id="line-192"></span><span>                </span><span class="annot"><span class="annottext">Maybe HValueRef
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; IO ForeignHValue
forall a. String -&gt; String -&gt; IO a
</span><a href="GHC.ByteCode.Linker.html#linkFail"><span class="hs-identifier hs-var">linkFail</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC.Runtime.Linker.getHValue&quot;</span></span><span>
</span><span id="line-193"></span><span>                             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; String
</span><a href="GHC.Data.FastString.html#unpackFS"><span class="hs-identifier hs-var">unpackFS</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681179986"><span class="hs-identifier hs-var">sym_to_find</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-194"></span><span>
</span><span id="line-195"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkDependencies"><span class="hs-identifier hs-type">linkDependencies</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-196"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-197"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#SuccessFlag"><span class="hs-identifier hs-type">SuccessFlag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-198"></span><span id="linkDependencies"><span class="annot"><span class="annottext">linkDependencies :: HscEnv
-&gt; PersistentLinkerState
-&gt; SrcSpan
-&gt; [Module]
-&gt; IO (PersistentLinkerState, SuccessFlag)
</span><a href="GHC.Runtime.Linker.html#linkDependencies"><span class="hs-identifier hs-var hs-var">linkDependencies</span></a></span></span><span> </span><span id="local-6989586621681179978"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179978"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179977"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179977"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span id="local-6989586621681179976"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179976"><span class="hs-identifier hs-var">span</span></a></span></span><span> </span><span id="local-6989586621681179975"><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681179975"><span class="hs-identifier hs-var">needed_mods</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-199"></span><span class="hs-comment">--   initDynLinker (hsc_dflags hsc_env) dl</span><span>
</span><span id="line-200"></span><span>   </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179974"><span class="annot"><span class="annottext">hpt :: HomePackageTable
</span><a href="#local-6989586621681179974"><span class="hs-identifier hs-var hs-var">hpt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; HomePackageTable
</span><a href="GHC.Driver.Types.html#hsc_HPT"><span class="hs-identifier hs-var hs-var">hsc_HPT</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179978"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-201"></span><span>   </span><span class="hs-comment">-- The interpreter and dynamic linker can only handle object code built</span><span>
</span><span id="line-202"></span><span>   </span><span class="hs-comment">-- the &quot;normal&quot; way, i.e. no non-std ways like profiling or ticky-ticky.</span><span>
</span><span id="line-203"></span><span>   </span><span class="hs-comment">-- So here we check the build tag: if we're building a non-standard way</span><span>
</span><span id="line-204"></span><span>   </span><span class="hs-comment">-- then we need to find &amp; link object files built the &quot;normal&quot; way.</span><span>
</span><span id="line-205"></span><span>   </span><span id="local-6989586621681179972"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179972"><span class="hs-identifier hs-var">maybe_normal_osuf</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; SrcSpan -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Linker.html#checkNonStdWay"><span class="hs-identifier hs-var">checkNonStdWay</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179978"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179976"><span class="hs-identifier hs-var">span</span></a></span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span>   </span><span class="hs-comment">-- Find what packages and linkables are required</span><span>
</span><span id="line-208"></span><span>   </span><span class="hs-special">(</span><span id="local-6989586621681179970"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179970"><span class="hs-identifier hs-var">lnks</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179969"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179969"><span class="hs-identifier hs-var">pkgs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; HomePackageTable
-&gt; PersistentLinkerState
-&gt; Maybe String
-&gt; SrcSpan
-&gt; [Module]
-&gt; IO ([Linkable], [UnitId])
</span><a href="GHC.Runtime.Linker.html#getLinkDeps"><span class="hs-identifier hs-var">getLinkDeps</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179978"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">HomePackageTable
</span><a href="#local-6989586621681179974"><span class="hs-identifier hs-var">hpt</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179977"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-209"></span><span>                               </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179972"><span class="hs-identifier hs-var">maybe_normal_osuf</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179976"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681179975"><span class="hs-identifier hs-var">needed_mods</span></a></span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span>   </span><span class="hs-comment">-- Link the packages and modules required</span><span>
</span><span id="line-212"></span><span>   </span><span id="local-6989586621681179967"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179967"><span class="hs-identifier hs-var">pls1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; [UnitId] -&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#linkPackages%27"><span class="hs-identifier hs-var">linkPackages'</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179978"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179969"><span class="hs-identifier hs-var">pkgs</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179977"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-213"></span><span>   </span><span class="annot"><span class="annottext">HscEnv
-&gt; PersistentLinkerState
-&gt; [Linkable]
-&gt; IO (PersistentLinkerState, SuccessFlag)
</span><a href="GHC.Runtime.Linker.html#linkModules"><span class="hs-identifier hs-var">linkModules</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179978"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179967"><span class="hs-identifier hs-var">pls1</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179970"><span class="hs-identifier hs-var">lnks</span></a></span><span>
</span><span id="line-214"></span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span class="hs-comment">-- | Temporarily extend the linker state.</span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span id="local-6989586621681180594"><span id="local-6989586621681180596"><span class="annot"><a href="GHC.Runtime.Linker.html#withExtendedLinkEnv"><span class="hs-identifier hs-type">withExtendedLinkEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Exception.html#ExceptionMonad"><span class="hs-identifier hs-type">ExceptionMonad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681180596"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-219"></span><span>                       </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-type">DynLinker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#ForeignHValue"><span class="hs-identifier hs-type">ForeignHValue</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681180596"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681180594"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681180596"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681180594"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-220"></span><span id="withExtendedLinkEnv"><span class="annot"><span class="annottext">withExtendedLinkEnv :: forall (m :: * -&gt; *) a.
ExceptionMonad m =&gt;
DynLinker -&gt; [(Name, ForeignHValue)] -&gt; m a -&gt; m a
</span><a href="GHC.Runtime.Linker.html#withExtendedLinkEnv"><span class="hs-identifier hs-var hs-var">withExtendedLinkEnv</span></a></span></span><span> </span><span id="local-6989586621681179957"><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179957"><span class="hs-identifier hs-var">dl</span></a></span></span><span> </span><span id="local-6989586621681179956"><span class="annot"><span class="annottext">[(Name, ForeignHValue)]
</span><a href="#local-6989586621681179956"><span class="hs-identifier hs-var">new_env</span></a></span></span><span> </span><span id="local-6989586621681179955"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621681179955"><span class="hs-identifier hs-var">action</span></a></span></span><span>
</span><span id="line-221"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m () -&gt; (() -&gt; m ()) -&gt; (() -&gt; m a) -&gt; m a
forall (m :: * -&gt; *) a c b.
MonadMask m =&gt;
m a -&gt; (a -&gt; m c) -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../exceptions/src/Control.Monad.Catch.html#bracket"><span class="hs-identifier hs-var">MC.bracket</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IO () -&gt; m ()
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; m ()) -&gt; IO () -&gt; m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker -&gt; [(Name, ForeignHValue)] -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#extendLinkEnv"><span class="hs-identifier hs-var">extendLinkEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179957"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, ForeignHValue)]
</span><a href="#local-6989586621681179956"><span class="hs-identifier hs-var">new_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-222"></span><span>               </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">m ()
</span><a href="#local-6989586621681179952"><span class="hs-identifier hs-var">reset_old_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-223"></span><span>               </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621681179955"><span class="hs-identifier hs-var">action</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-224"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-225"></span><span>        </span><span class="hs-comment">-- Remember that the linker state might be side-effected</span><span>
</span><span id="line-226"></span><span>        </span><span class="hs-comment">-- during the execution of the IO action, and we don't want to</span><span>
</span><span id="line-227"></span><span>        </span><span class="hs-comment">-- lose those changes (we might have linked a new module or</span><span>
</span><span id="line-228"></span><span>        </span><span class="hs-comment">-- package), so the reset action only removes the names we</span><span>
</span><span id="line-229"></span><span>        </span><span class="hs-comment">-- added earlier.</span><span>
</span><span id="line-230"></span><span>          </span><span id="local-6989586621681179952"><span class="annot"><span class="annottext">reset_old_env :: m ()
</span><a href="#local-6989586621681179952"><span class="hs-identifier hs-var hs-var">reset_old_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; m ()
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; m ()) -&gt; IO () -&gt; m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-231"></span><span>            </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#modifyPLS_"><span class="hs-identifier hs-var">modifyPLS_</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179957"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ())
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681179949"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179949"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-232"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179948"><span class="annot"><span class="annottext">cur :: ClosureEnv
</span><a href="#local-6989586621681179948"><span class="hs-identifier hs-var hs-var">cur</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var hs-var">closure_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179949"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-233"></span><span>                    </span><span id="local-6989586621681179947"><span class="annot"><span class="annottext">new :: ClosureEnv
</span><a href="#local-6989586621681179947"><span class="hs-identifier hs-var hs-var">new</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureEnv -&gt; [Name] -&gt; ClosureEnv
forall a. NameEnv a -&gt; [Name] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#delListFromNameEnv"><span class="hs-identifier hs-var">delListFromNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179948"><span class="hs-identifier hs-var">cur</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Name, ForeignHValue) -&gt; Name)
-&gt; [(Name, ForeignHValue)] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, ForeignHValue) -&gt; Name
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, ForeignHValue)]
</span><a href="#local-6989586621681179956"><span class="hs-identifier hs-var">new_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-234"></span><span>                </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179949"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">closure_env :: ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var">closure_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179947"><span class="hs-identifier hs-var">new</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span>
</span><span id="line-237"></span><span class="hs-comment">-- | Display the persistent linker state.</span><span>
</span><span id="line-238"></span><span class="annot"><a href="GHC.Runtime.Linker.html#showLinkerState"><span class="hs-identifier hs-type">showLinkerState</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DynLinker"><span class="hs-identifier hs-type">DynLinker</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-239"></span><span id="showLinkerState"><span class="annot"><span class="annottext">showLinkerState :: DynLinker -&gt; IO SDoc
</span><a href="GHC.Runtime.Linker.html#showLinkerState"><span class="hs-identifier hs-var hs-var">showLinkerState</span></a></span></span><span> </span><span id="local-6989586621681179946"><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179946"><span class="hs-identifier hs-var">dl</span></a></span></span><span>
</span><span id="line-240"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681179945"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179945"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynLinker -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#readPLS"><span class="hs-identifier hs-var">readPLS</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179946"><span class="hs-identifier hs-var">dl</span></a></span><span>
</span><span id="line-241"></span><span>       </span><span class="annot"><span class="annottext">SDoc -&gt; IO SDoc
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO SDoc) -&gt; SDoc -&gt; IO SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#withPprStyle"><span class="hs-identifier hs-var">withPprStyle</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle
</span><a href="GHC.Utils.Outputable.html#defaultDumpStyle"><span class="hs-identifier hs-var">defaultDumpStyle</span></a></span><span>
</span><span id="line-242"></span><span>                 </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;----- Linker state -----&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-243"></span><span>                        </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Pkgs:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [UnitId]
</span><a href="GHC.Runtime.Linker.Types.html#pkgs_loaded"><span class="hs-identifier hs-var hs-var">pkgs_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179945"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-244"></span><span>                        </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Objs:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#objs_loaded"><span class="hs-identifier hs-var hs-var">objs_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179945"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-245"></span><span>                        </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;BCOs:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#bcos_loaded"><span class="hs-identifier hs-var hs-var">bcos_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179945"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-246"></span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span class="hs-comment">{- **********************************************************************

                        Initialisation

  ********************************************************************* -}</span><span>
</span><span id="line-253"></span><span>
</span><span id="line-254"></span><span class="hs-comment">-- | Initialise the dynamic linker.  This entails</span><span>
</span><span id="line-255"></span><span class="hs-comment">--</span><span>
</span><span id="line-256"></span><span class="hs-comment">--  a) Calling the C initialisation procedure,</span><span>
</span><span id="line-257"></span><span class="hs-comment">--</span><span>
</span><span id="line-258"></span><span class="hs-comment">--  b) Loading any packages specified on the command line,</span><span>
</span><span id="line-259"></span><span class="hs-comment">--</span><span>
</span><span id="line-260"></span><span class="hs-comment">--  c) Loading any packages specified on the command line, now held in the</span><span>
</span><span id="line-261"></span><span class="hs-comment">--     @-l@ options in @v_Opt_l@,</span><span>
</span><span id="line-262"></span><span class="hs-comment">--</span><span>
</span><span id="line-263"></span><span class="hs-comment">--  d) Loading any @.o\/.dll@ files specified on the command line, now held</span><span>
</span><span id="line-264"></span><span class="hs-comment">--     in @ldInputs@,</span><span>
</span><span id="line-265"></span><span class="hs-comment">--</span><span>
</span><span id="line-266"></span><span class="hs-comment">--  e) Loading any MacOS frameworks.</span><span>
</span><span id="line-267"></span><span class="hs-comment">--</span><span>
</span><span id="line-268"></span><span class="hs-comment">-- NOTE: This function is idempotent; if called more than once, it does</span><span>
</span><span id="line-269"></span><span class="hs-comment">-- nothing.  This is useful in Template Haskell, where we call it before</span><span>
</span><span id="line-270"></span><span class="hs-comment">-- trying to link.</span><span>
</span><span id="line-271"></span><span class="hs-comment">--</span><span>
</span><span id="line-272"></span><span class="annot"><a href="GHC.Runtime.Linker.html#initDynLinker"><span class="hs-identifier hs-type">initDynLinker</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-273"></span><span id="initDynLinker"><span class="annot"><span class="annottext">initDynLinker :: HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#initDynLinker"><span class="hs-identifier hs-var hs-var">initDynLinker</span></a></span></span><span> </span><span id="local-6989586621681179939"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179939"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-274"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179938"><span class="annot"><span class="annottext">dl :: DynLinker
</span><a href="#local-6989586621681179938"><span class="hs-identifier hs-var hs-var">dl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynLinker
</span><a href="GHC.Driver.Types.html#hsc_dynLinker"><span class="hs-identifier hs-var hs-var">hsc_dynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179939"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-275"></span><span>  </span><span class="annot"><span class="annottext">DynLinker
-&gt; (Maybe PersistentLinkerState
    -&gt; IO (Maybe PersistentLinkerState))
-&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#modifyMbPLS_"><span class="hs-identifier hs-var">modifyMbPLS_</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179938"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((Maybe PersistentLinkerState -&gt; IO (Maybe PersistentLinkerState))
 -&gt; IO ())
-&gt; (Maybe PersistentLinkerState
    -&gt; IO (Maybe PersistentLinkerState))
-&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681179937"><span class="annot"><span class="annottext">Maybe PersistentLinkerState
</span><a href="#local-6989586621681179937"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-276"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe PersistentLinkerState
</span><a href="#local-6989586621681179937"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-277"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span>  </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe PersistentLinkerState -&gt; IO (Maybe PersistentLinkerState)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe PersistentLinkerState
</span><a href="#local-6989586621681179937"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-278"></span><span>      </span><span class="annot"><span class="annottext">Maybe PersistentLinkerState
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; Maybe PersistentLinkerState
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(PersistentLinkerState -&gt; Maybe PersistentLinkerState)
-&gt; IO PersistentLinkerState -&gt; IO (Maybe PersistentLinkerState)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#reallyInitDynLinker"><span class="hs-identifier hs-var">reallyInitDynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179939"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-279"></span><span>
</span><span id="line-280"></span><span class="annot"><a href="GHC.Runtime.Linker.html#reallyInitDynLinker"><span class="hs-identifier hs-type">reallyInitDynLinker</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-281"></span><span id="reallyInitDynLinker"><span class="annot"><span class="annottext">reallyInitDynLinker :: HscEnv -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#reallyInitDynLinker"><span class="hs-identifier hs-var hs-var">reallyInitDynLinker</span></a></span></span><span> </span><span id="local-6989586621681179934"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179934"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-282"></span><span>  </span><span class="hs-comment">-- Initialise the linker state</span><span>
</span><span id="line-283"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179933"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681179933"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179934"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-284"></span><span>      </span><span id="local-6989586621681179931"><span class="annot"><span class="annottext">pls0 :: PersistentLinkerState
</span><a href="#local-6989586621681179931"><span class="hs-identifier hs-var hs-var">pls0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#emptyPLS"><span class="hs-identifier hs-var">emptyPLS</span></a></span><span>
</span><span id="line-285"></span><span>
</span><span id="line-286"></span><span>  </span><span class="hs-comment">-- (a) initialise the C dynamic linker</span><span>
</span><span id="line-287"></span><span>  </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Interpreter.html#initObjLinker"><span class="hs-identifier hs-var">initObjLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179934"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-288"></span><span>
</span><span id="line-289"></span><span>  </span><span class="hs-comment">-- (b) Load packages from the command-line (Note [preload packages])</span><span>
</span><span id="line-290"></span><span>  </span><span id="local-6989586621681179929"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179929"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; [UnitId] -&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#linkPackages%27"><span class="hs-identifier hs-var">linkPackages'</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179934"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnitState -&gt; [UnitId]
</span><a href="GHC.Unit.State.html#preloadUnits"><span class="hs-identifier hs-var hs-var">preloadUnits</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; UnitState
</span><a href="GHC.Driver.Session.html#unitState"><span class="hs-identifier hs-var hs-var">unitState</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179933"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179931"><span class="hs-identifier hs-var">pls0</span></a></span><span>
</span><span id="line-291"></span><span>
</span><span id="line-292"></span><span>  </span><span class="hs-comment">-- steps (c), (d) and (e)</span><span>
</span><span id="line-293"></span><span>  </span><span class="annot"><span class="annottext">HscEnv -&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#linkCmdLineLibs%27"><span class="hs-identifier hs-var">linkCmdLineLibs'</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179934"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179929"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-294"></span><span>
</span><span id="line-295"></span><span>
</span><span id="line-296"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkCmdLineLibs"><span class="hs-identifier hs-type">linkCmdLineLibs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-297"></span><span id="linkCmdLineLibs"><span class="annot"><span class="annottext">linkCmdLineLibs :: HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#linkCmdLineLibs"><span class="hs-identifier hs-var hs-var">linkCmdLineLibs</span></a></span></span><span> </span><span id="local-6989586621681179925"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179925"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-298"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179924"><span class="annot"><span class="annottext">dl :: DynLinker
</span><a href="#local-6989586621681179924"><span class="hs-identifier hs-var hs-var">dl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynLinker
</span><a href="GHC.Driver.Types.html#hsc_dynLinker"><span class="hs-identifier hs-var hs-var">hsc_dynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179925"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-299"></span><span>  </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#initDynLinker"><span class="hs-identifier hs-var">initDynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179925"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-300"></span><span>  </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#modifyPLS_"><span class="hs-identifier hs-var">modifyPLS_</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179924"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ())
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681179923"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179923"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-301"></span><span>    </span><span class="annot"><span class="annottext">HscEnv -&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#linkCmdLineLibs%27"><span class="hs-identifier hs-var">linkCmdLineLibs'</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179925"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179923"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-302"></span><span>
</span><span id="line-303"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkCmdLineLibs%27"><span class="hs-identifier hs-type">linkCmdLineLibs'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-304"></span><span id="linkCmdLineLibs%27"><span class="annot"><span class="annottext">linkCmdLineLibs' :: HscEnv -&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#linkCmdLineLibs%27"><span class="hs-identifier hs-var hs-var">linkCmdLineLibs'</span></a></span></span><span> </span><span id="local-6989586621681179922"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179922"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179921"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179921"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-305"></span><span>  </span><span class="hs-keyword">do</span><span>
</span><span id="line-306"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179920"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ldInputs :: DynFlags -&gt; [Option]
</span><a href="GHC.Driver.Session.html#ldInputs"><span class="hs-identifier hs-var">ldInputs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681179917"><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621681179917"><span class="hs-identifier hs-var">cmdline_ld_inputs</span></a></span></span><span>
</span><span id="line-307"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">libraryPaths :: DynFlags -&gt; [String]
</span><a href="GHC.Driver.Session.html#libraryPaths"><span class="hs-identifier hs-var">libraryPaths</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681179915"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179915"><span class="hs-identifier hs-var">lib_paths_base</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-308"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179922"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-309"></span><span>
</span><span id="line-310"></span><span>      </span><span class="hs-comment">-- (c) Link libraries from the command-line</span><span>
</span><span id="line-311"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179914"><span class="annot"><span class="annottext">minus_ls_1 :: [String]
</span><a href="#local-6989586621681179914"><span class="hs-identifier hs-var hs-var">minus_ls_1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179913"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'l'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179913"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179913"><span class="hs-identifier hs-var">lib</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621681179917"><span class="hs-identifier hs-var">cmdline_ld_inputs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-312"></span><span>
</span><span id="line-313"></span><span>      </span><span class="hs-comment">-- On Windows we want to add libpthread by default just as GCC would.</span><span>
</span><span id="line-314"></span><span>      </span><span class="hs-comment">-- However because we don't know the actual name of pthread's dll we</span><span>
</span><span id="line-315"></span><span>      </span><span class="hs-comment">-- need to defer this to the locateLib call so we can't initialize it</span><span>
</span><span id="line-316"></span><span>      </span><span class="hs-comment">-- inside of the rts. Instead we do it here to be able to find the</span><span>
</span><span id="line-317"></span><span>      </span><span class="hs-comment">-- import library for pthreads. See #13210.</span><span>
</span><span id="line-318"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179911"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681179911"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-319"></span><span>          </span><span id="local-6989586621681179909"><span class="annot"><span class="annottext">os :: OS
</span><a href="#local-6989586621681179909"><span class="hs-identifier hs-var hs-var">os</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformOS"><span class="hs-identifier hs-var">platformOS</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179911"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-320"></span><span>          </span><span id="local-6989586621681179907"><span class="annot"><span class="annottext">minus_ls :: [String]
</span><a href="#local-6989586621681179907"><span class="hs-identifier hs-var hs-var">minus_ls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="#local-6989586621681179909"><span class="hs-identifier hs-var">os</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-321"></span><span>                       </span><span class="annot"><span class="annottext">OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#OSMinGW32"><span class="hs-identifier hs-var">OSMinGW32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;pthread&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179914"><span class="hs-identifier hs-var">minus_ls_1</span></a></span><span>
</span><span id="line-322"></span><span>                       </span><span class="annot"><span class="annottext">OS
</span><span class="hs-identifier">_</span></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179914"><span class="hs-identifier hs-var">minus_ls_1</span></a></span><span>
</span><span id="line-323"></span><span>      </span><span class="hs-comment">-- See Note [Fork/Exec Windows]</span><span>
</span><span id="line-324"></span><span>      </span><span id="local-6989586621681179905"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179905"><span class="hs-identifier hs-var">gcc_paths</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; OS -&gt; IO [String]
</span><a href="GHC.Runtime.Linker.html#getGCCPaths"><span class="hs-identifier hs-var">getGCCPaths</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="#local-6989586621681179909"><span class="hs-identifier hs-var">os</span></a></span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span>      </span><span id="local-6989586621681179903"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179903"><span class="hs-identifier hs-var">lib_paths_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; IO [String]
</span><a href="GHC.Runtime.Linker.html#addEnvPaths"><span class="hs-identifier hs-var">addEnvPaths</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;LIBRARY_PATH&quot;</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179915"><span class="hs-identifier hs-var">lib_paths_base</span></a></span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span>      </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var">maybePutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Search directories (user):&quot;</span></span><span>
</span><span id="line-329"></span><span>      </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStr"><span class="hs-identifier hs-var">maybePutStr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; String
</span><a href="../../base/src/Data.OldList.html#unlines"><span class="hs-identifier hs-var">unlines</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; String) -&gt; [String] -&gt; String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  &quot;</span></span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179903"><span class="hs-identifier hs-var">lib_paths_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-330"></span><span>      </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var">maybePutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Search directories (gcc):&quot;</span></span><span>
</span><span id="line-331"></span><span>      </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStr"><span class="hs-identifier hs-var">maybePutStr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; String
</span><a href="../../base/src/Data.OldList.html#unlines"><span class="hs-identifier hs-var">unlines</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; String) -&gt; [String] -&gt; String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  &quot;</span></span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179905"><span class="hs-identifier hs-var">gcc_paths</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-332"></span><span>
</span><span id="line-333"></span><span>      </span><span id="local-6989586621681179898"><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179898"><span class="hs-identifier hs-var">libspecs</span></a></span></span><span>
</span><span id="line-334"></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO LibrarySpec) -&gt; [String] -&gt; IO [LibrarySpec]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; Bool -&gt; [String] -&gt; [String] -&gt; String -&gt; IO LibrarySpec
</span><a href="GHC.Runtime.Linker.html#locateLib"><span class="hs-identifier hs-var">locateLib</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179922"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179903"><span class="hs-identifier hs-var">lib_paths_env</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179905"><span class="hs-identifier hs-var">gcc_paths</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179907"><span class="hs-identifier hs-var">minus_ls</span></a></span><span>
</span><span id="line-335"></span><span>
</span><span id="line-336"></span><span>      </span><span class="hs-comment">-- (d) Link .o files from the command-line</span><span>
</span><span id="line-337"></span><span>      </span><span id="local-6989586621681179895"><span class="annot"><span class="annottext">[Maybe LibrarySpec]
</span><a href="#local-6989586621681179895"><span class="hs-identifier hs-var">classified_ld_inputs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO (Maybe LibrarySpec))
-&gt; [String] -&gt; IO [Maybe LibrarySpec]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO (Maybe LibrarySpec)
</span><a href="GHC.Runtime.Linker.html#classifyLdInput"><span class="hs-identifier hs-var">classifyLdInput</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-338"></span><span>                                </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179893"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Utils.CliOption.html#FileOption"><span class="hs-identifier hs-type">FileOption</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681179893"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179893"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Option]
</span><a href="#local-6989586621681179917"><span class="hs-identifier hs-var">cmdline_ld_inputs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-339"></span><span>
</span><span id="line-340"></span><span>      </span><span class="hs-comment">-- (e) Link any MacOS frameworks</span><span>
</span><span id="line-341"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179891"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681179891"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-342"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179890"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179890"><span class="hs-identifier hs-var">framework_paths</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179889"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179889"><span class="hs-identifier hs-var">frameworks</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-343"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Bool
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformUsesFrameworks"><span class="hs-identifier hs-var">platformUsesFrameworks</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179891"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-344"></span><span>             </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; [String]
</span><a href="GHC.Driver.Session.html#frameworkPaths"><span class="hs-identifier hs-var hs-var">frameworkPaths</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [String]
</span><a href="GHC.Driver.Session.html#cmdlineFrameworks"><span class="hs-identifier hs-var hs-var">cmdlineFrameworks</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-345"></span><span>              </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-346"></span><span>
</span><span id="line-347"></span><span>      </span><span class="hs-comment">-- Finally do (c),(d),(e)</span><span>
</span><span id="line-348"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179885"><span class="annot"><span class="annottext">cmdline_lib_specs :: [LibrarySpec]
</span><a href="#local-6989586621681179885"><span class="hs-identifier hs-var hs-var">cmdline_lib_specs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Maybe LibrarySpec] -&gt; [LibrarySpec]
forall a. [Maybe a] -&gt; [a]
</span><a href="../../base/src/Data.Maybe.html#catMaybes"><span class="hs-identifier hs-var">catMaybes</span></a></span><span> </span><span class="annot"><span class="annottext">[Maybe LibrarySpec]
</span><a href="#local-6989586621681179895"><span class="hs-identifier hs-var">classified_ld_inputs</span></a></span><span>
</span><span id="line-349"></span><span>                           </span><span class="annot"><span class="annottext">[LibrarySpec] -&gt; [LibrarySpec] -&gt; [LibrarySpec]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179898"><span class="hs-identifier hs-var">libspecs</span></a></span><span>
</span><span id="line-350"></span><span>                           </span><span class="annot"><span class="annottext">[LibrarySpec] -&gt; [LibrarySpec] -&gt; [LibrarySpec]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec) -&gt; [String] -&gt; [LibrarySpec]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#Framework"><span class="hs-identifier hs-var">Framework</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179889"><span class="hs-identifier hs-var">frameworks</span></a></span><span>
</span><span id="line-351"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179885"><span class="hs-identifier hs-var">cmdline_lib_specs</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179921"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-352"></span><span>                                </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-353"></span><span>
</span><span id="line-354"></span><span>      </span><span class="hs-comment">-- Add directories to library search paths, this only has an effect</span><span>
</span><span id="line-355"></span><span>      </span><span class="hs-comment">-- on Windows. On Unix OSes this function is a NOP.</span><span>
</span><span id="line-356"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179879"><span class="annot"><span class="annottext">all_paths :: [String]
</span><a href="#local-6989586621681179879"><span class="hs-identifier hs-var hs-var">all_paths</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179878"><span class="annot"><span class="annottext">paths :: [String]
</span><a href="#local-6989586621681179878"><span class="hs-identifier hs-var hs-var">paths</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#takeDirectory"><span class="hs-identifier hs-var">takeDirectory</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; String
</span><a href="GHC.Driver.Session.html#pgm_c"><span class="hs-identifier hs-var">pgm_c</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-357"></span><span>                                </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179890"><span class="hs-identifier hs-var">framework_paths</span></a></span><span>
</span><span id="line-358"></span><span>                               </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179915"><span class="hs-identifier hs-var">lib_paths_base</span></a></span><span>
</span><span id="line-359"></span><span>                               </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#takeDirectory"><span class="hs-identifier hs-var">takeDirectory</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179875"><span class="hs-identifier hs-var">dll</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#DLLPath"><span class="hs-identifier hs-type">DLLPath</span></a></span><span> </span><span id="local-6989586621681179875"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179875"><span class="hs-identifier hs-var">dll</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179898"><span class="hs-identifier hs-var">libspecs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-360"></span><span>                      </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String]
forall a. Eq a =&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#nub"><span class="hs-identifier hs-var">nub</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String]) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#normalise"><span class="hs-identifier hs-var">normalise</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179878"><span class="hs-identifier hs-var">paths</span></a></span><span>
</span><span id="line-361"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179870"><span class="annot"><span class="annottext">lib_paths :: [String]
</span><a href="#local-6989586621681179870"><span class="hs-identifier hs-var hs-var">lib_paths</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String]
forall a. Eq a =&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#nub"><span class="hs-identifier hs-var">nub</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String]) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179915"><span class="hs-identifier hs-var">lib_paths_base</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179905"><span class="hs-identifier hs-var">gcc_paths</span></a></span><span>
</span><span id="line-362"></span><span>      </span><span id="local-6989586621681179869"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179869"><span class="hs-identifier hs-var">all_paths_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; IO [String]
</span><a href="GHC.Runtime.Linker.html#addEnvPaths"><span class="hs-identifier hs-var">addEnvPaths</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;LD_LIBRARY_PATH&quot;</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179879"><span class="hs-identifier hs-var">all_paths</span></a></span><span>
</span><span id="line-363"></span><span>      </span><span id="local-6989586621681179868"><span class="annot"><span class="annottext">[Ptr ()]
</span><a href="#local-6989586621681179868"><span class="hs-identifier hs-var">pathCache</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO (Ptr ())) -&gt; [String] -&gt; IO [Ptr ()]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO (Ptr ())
</span><a href="GHC.Runtime.Interpreter.html#addLibrarySearchPath"><span class="hs-identifier hs-var">addLibrarySearchPath</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179922"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179869"><span class="hs-identifier hs-var">all_paths_env</span></a></span><span>
</span><span id="line-364"></span><span>
</span><span id="line-365"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179866"><span class="annot"><span class="annottext">merged_specs :: [LibrarySpec]
</span><a href="#local-6989586621681179866"><span class="hs-identifier hs-var hs-var">merged_specs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec] -&gt; [LibrarySpec]
</span><a href="GHC.Runtime.Linker.html#mergeStaticObjects"><span class="hs-identifier hs-var">mergeStaticObjects</span></a></span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179885"><span class="hs-identifier hs-var">cmdline_lib_specs</span></a></span><span>
</span><span id="line-366"></span><span>      </span><span id="local-6989586621681179864"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179864"><span class="hs-identifier hs-var">pls1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(PersistentLinkerState -&gt; LibrarySpec -&gt; IO PersistentLinkerState)
-&gt; PersistentLinkerState
-&gt; [LibrarySpec]
-&gt; IO PersistentLinkerState
forall (t :: * -&gt; *) (m :: * -&gt; *) b a.
(Foldable t, Monad m) =&gt;
(b -&gt; a -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Control.Monad.html#foldM"><span class="hs-identifier hs-var">foldM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv
-&gt; [String]
-&gt; [String]
-&gt; PersistentLinkerState
-&gt; LibrarySpec
-&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#preloadLib"><span class="hs-identifier hs-var">preloadLib</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179922"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179870"><span class="hs-identifier hs-var">lib_paths</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179890"><span class="hs-identifier hs-var">framework_paths</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179921"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-367"></span><span>                    </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179866"><span class="hs-identifier hs-var">merged_specs</span></a></span><span>
</span><span id="line-368"></span><span>
</span><span id="line-369"></span><span>      </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStr"><span class="hs-identifier hs-var">maybePutStr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;final link ... &quot;</span></span><span>
</span><span id="line-370"></span><span>      </span><span id="local-6989586621681179861"><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179861"><span class="hs-identifier hs-var">ok</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; IO SuccessFlag
</span><a href="GHC.Runtime.Interpreter.html#resolveObjs"><span class="hs-identifier hs-var">resolveObjs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179922"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-371"></span><span>
</span><span id="line-372"></span><span>      </span><span class="hs-comment">-- DLLs are loaded, reset the search paths</span><span>
</span><span id="line-373"></span><span>      </span><span class="annot"><span class="annottext">(Ptr () -&gt; IO Bool) -&gt; [Ptr ()] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; Ptr () -&gt; IO Bool
</span><a href="GHC.Runtime.Interpreter.html#removeLibrarySearchPath"><span class="hs-identifier hs-var">removeLibrarySearchPath</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179922"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([Ptr ()] -&gt; IO ()) -&gt; [Ptr ()] -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Ptr ()] -&gt; [Ptr ()]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Ptr ()]
</span><a href="#local-6989586621681179868"><span class="hs-identifier hs-var">pathCache</span></a></span><span>
</span><span id="line-374"></span><span>
</span><span id="line-375"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">SuccessFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#succeeded"><span class="hs-identifier hs-var">succeeded</span></a></span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179861"><span class="hs-identifier hs-var">ok</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var">maybePutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179920"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;done&quot;</span></span><span>
</span><span id="line-376"></span><span>      </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO ()
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linking extra libraries/objects failed&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-377"></span><span>
</span><span id="line-378"></span><span>      </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179864"><span class="hs-identifier hs-var">pls1</span></a></span><span>
</span><span id="line-379"></span><span>
</span><span id="line-380"></span><span class="hs-comment">-- | Merge runs of consecutive of 'Objects'. This allows for resolution of</span><span>
</span><span id="line-381"></span><span class="hs-comment">-- cyclic symbol references when dynamically linking. Specifically, we link</span><span>
</span><span id="line-382"></span><span class="hs-comment">-- together all of the static objects into a single shared object, avoiding</span><span>
</span><span id="line-383"></span><span class="hs-comment">-- the issue we saw in #13786.</span><span>
</span><span id="line-384"></span><span class="annot"><a href="GHC.Runtime.Linker.html#mergeStaticObjects"><span class="hs-identifier hs-type">mergeStaticObjects</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-type">LibrarySpec</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-type">LibrarySpec</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-385"></span><span id="mergeStaticObjects"><span class="annot"><span class="annottext">mergeStaticObjects :: [LibrarySpec] -&gt; [LibrarySpec]
</span><a href="GHC.Runtime.Linker.html#mergeStaticObjects"><span class="hs-identifier hs-var hs-var">mergeStaticObjects</span></a></span></span><span> </span><span id="local-6989586621681179855"><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179855"><span class="hs-identifier hs-var">specs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [LibrarySpec] -&gt; [LibrarySpec]
</span><a href="#local-6989586621681179854"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179855"><span class="hs-identifier hs-var">specs</span></a></span><span>
</span><span id="line-386"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-387"></span><span>    </span><span class="annot"><a href="#local-6989586621681179854"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-type">LibrarySpec</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-type">LibrarySpec</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-388"></span><span>    </span><span id="local-6989586621681179854"><span class="annot"><span class="annottext">go :: [String] -&gt; [LibrarySpec] -&gt; [LibrarySpec]
</span><a href="#local-6989586621681179854"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621681179852"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179852"><span class="hs-identifier hs-var">accum</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#Objects"><span class="hs-identifier hs-type">Objects</span></a></span><span> </span><span id="local-6989586621681179850"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179850"><span class="hs-identifier hs-var">objs</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681179849"><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179849"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [LibrarySpec] -&gt; [LibrarySpec]
</span><a href="#local-6989586621681179854"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179850"><span class="hs-identifier hs-var">objs</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179852"><span class="hs-identifier hs-var">accum</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179849"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-389"></span><span>    </span><span class="annot"><a href="#local-6989586621681179854"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621681179848"><span class="annot"><span class="annottext">accum :: [String]
</span><a href="#local-6989586621681179848"><span class="hs-identifier hs-var">accum</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[String]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681179847"><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179847"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#Objects"><span class="hs-identifier hs-var">Objects</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; [String]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179848"><span class="hs-identifier hs-var">accum</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LibrarySpec -&gt; [LibrarySpec] -&gt; [LibrarySpec]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [LibrarySpec] -&gt; [LibrarySpec]
</span><a href="#local-6989586621681179854"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179847"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-390"></span><span>    </span><span class="annot"><a href="#local-6989586621681179854"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179846"><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179846"><span class="hs-identifier hs-var">spec</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179845"><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179845"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179846"><span class="hs-identifier hs-var">spec</span></a></span><span> </span><span class="annot"><span class="annottext">LibrarySpec -&gt; [LibrarySpec] -&gt; [LibrarySpec]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [LibrarySpec] -&gt; [LibrarySpec]
</span><a href="#local-6989586621681179854"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179845"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-391"></span><span>    </span><span class="annot"><a href="#local-6989586621681179854"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-392"></span><span>
</span><span id="line-393"></span><span class="hs-comment">{- Note [preload packages]

Why do we need to preload packages from the command line?  This is an
explanation copied from #2437:

I tried to implement the suggestion from #3560, thinking it would be
easy, but there are two reasons we link in packages eagerly when they
are mentioned on the command line:

  * So that you can link in extra object files or libraries that
    depend on the packages. e.g. ghc -package foo -lbar where bar is a
    C library that depends on something in foo. So we could link in
    foo eagerly if and only if there are extra C libs or objects to
    link in, but....

  * Haskell code can depend on a C function exported by a package, and
    the normal dependency tracking that TH uses can't know about these
    dependencies. The test ghcilink004 relies on this, for example.

I conclude that we need two -package flags: one that says &quot;this is a
package I want to make available&quot;, and one that says &quot;this is a
package I want to link in eagerly&quot;. Would that be too complicated for
users?
-}</span><span>
</span><span id="line-417"></span><span>
</span><span id="line-418"></span><span class="annot"><a href="GHC.Runtime.Linker.html#classifyLdInput"><span class="hs-identifier hs-type">classifyLdInput</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-type">LibrarySpec</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-419"></span><span id="classifyLdInput"><span class="annot"><span class="annottext">classifyLdInput :: DynFlags -&gt; String -&gt; IO (Maybe LibrarySpec)
</span><a href="GHC.Runtime.Linker.html#classifyLdInput"><span class="hs-identifier hs-var hs-var">classifyLdInput</span></a></span></span><span> </span><span id="local-6989586621681179844"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179844"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681179843"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179843"><span class="hs-identifier hs-var">f</span></a></span></span><span>
</span><span id="line-420"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; String -&gt; Bool
</span><a href="GHC.Driver.Phases.html#isObjectFilename"><span class="hs-identifier hs-var">isObjectFilename</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179841"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179843"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe LibrarySpec -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LibrarySpec -&gt; Maybe LibrarySpec
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#Objects"><span class="hs-identifier hs-var">Objects</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179843"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-421"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; String -&gt; Bool
</span><a href="GHC.Driver.Phases.html#isDynLibFilename"><span class="hs-identifier hs-var">isDynLibFilename</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179841"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179843"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe LibrarySpec -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LibrarySpec -&gt; Maybe LibrarySpec
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#DLLPath"><span class="hs-identifier hs-var">DLLPath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179843"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-422"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-423"></span><span>        </span><span class="annot"><span class="annottext">DynFlags -&gt; WarnReason -&gt; Severity -&gt; SrcSpan -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Driver.Session.html#putLogMsg"><span class="hs-identifier hs-var">putLogMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179844"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason
</span><a href="GHC.Driver.Flags.html#NoReason"><span class="hs-identifier hs-var">NoReason</span></a></span><span> </span><span class="annot"><span class="annottext">Severity
</span><a href="GHC.Utils.Error.html#SevInfo"><span class="hs-identifier hs-var">SevInfo</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier hs-var">noSrcSpan</span></a></span><span>
</span><span id="line-424"></span><span>            </span><span class="annot"><span class="annottext">(SDoc -&gt; IO ()) -&gt; SDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#withPprStyle"><span class="hs-identifier hs-var">withPprStyle</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle
</span><a href="GHC.Utils.Outputable.html#defaultUserStyle"><span class="hs-identifier hs-var">defaultUserStyle</span></a></span><span>
</span><span id="line-425"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Warning: ignoring unrecognised input `&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179843"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;'&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-426"></span><span>        </span><span class="annot"><span class="annottext">Maybe LibrarySpec -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe LibrarySpec
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-427"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681179841"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681179841"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179844"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-428"></span><span>
</span><span id="line-429"></span><span class="annot"><a href="GHC.Runtime.Linker.html#preloadLib"><span class="hs-identifier hs-type">preloadLib</span></a></span><span>
</span><span id="line-430"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-431"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-type">LibrarySpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-432"></span><span id="preloadLib"><span class="annot"><span class="annottext">preloadLib :: HscEnv
-&gt; [String]
-&gt; [String]
-&gt; PersistentLinkerState
-&gt; LibrarySpec
-&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#preloadLib"><span class="hs-identifier hs-var hs-var">preloadLib</span></a></span></span><span> </span><span id="local-6989586621681179835"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179835"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179834"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179834"><span class="hs-identifier hs-var">lib_paths</span></a></span></span><span> </span><span id="local-6989586621681179833"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179833"><span class="hs-identifier hs-var">framework_paths</span></a></span></span><span> </span><span id="local-6989586621681179832"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179832"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span id="local-6989586621681179831"><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179831"><span class="hs-identifier hs-var">lib_spec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-433"></span><span>  </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStr"><span class="hs-identifier hs-var">maybePutStr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Loading object &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">LibrarySpec -&gt; String
</span><a href="GHC.Runtime.Linker.html#showLS"><span class="hs-identifier hs-var">showLS</span></a></span><span> </span><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179831"><span class="hs-identifier hs-var">lib_spec</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; ... &quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-434"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179831"><span class="hs-identifier hs-var">lib_spec</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-435"></span><span>    </span><span class="annot"><a href="GHC.Runtime.Linker.html#Objects"><span class="hs-identifier hs-type">Objects</span></a></span><span> </span><span id="local-6989586621681179828"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179828"><span class="hs-identifier hs-var">static_ishs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-436"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621681179827"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179827"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179826"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179826"><span class="hs-identifier hs-var">pls1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; IO (Bool, PersistentLinkerState)
forall {p}. p -&gt; [String] -&gt; IO (Bool, PersistentLinkerState)
</span><a href="#local-6989586621681179825"><span class="hs-identifier hs-var">preload_statics</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179834"><span class="hs-identifier hs-var">lib_paths</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179828"><span class="hs-identifier hs-var">static_ishs</span></a></span><span>
</span><span id="line-437"></span><span>      </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var">maybePutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179827"><span class="hs-identifier hs-var">b</span></a></span><span>  </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;done&quot;</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;not found&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-438"></span><span>      </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179826"><span class="hs-identifier hs-var">pls1</span></a></span><span>
</span><span id="line-439"></span><span>
</span><span id="line-440"></span><span>    </span><span class="annot"><a href="GHC.Runtime.Linker.html#Archive"><span class="hs-identifier hs-type">Archive</span></a></span><span> </span><span id="local-6989586621681179823"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179823"><span class="hs-identifier hs-var">static_ish</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-441"></span><span>      </span><span id="local-6989586621681179822"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179822"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String -&gt; IO Bool
forall {p}. p -&gt; String -&gt; IO Bool
</span><a href="#local-6989586621681179821"><span class="hs-identifier hs-var">preload_static_archive</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179834"><span class="hs-identifier hs-var">lib_paths</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179823"><span class="hs-identifier hs-var">static_ish</span></a></span><span>
</span><span id="line-442"></span><span>      </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var">maybePutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179822"><span class="hs-identifier hs-var">b</span></a></span><span>  </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;done&quot;</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;not found&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-443"></span><span>      </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179832"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-444"></span><span>
</span><span id="line-445"></span><span>    </span><span class="annot"><a href="GHC.Runtime.Linker.html#DLL"><span class="hs-identifier hs-type">DLL</span></a></span><span> </span><span id="local-6989586621681179819"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179819"><span class="hs-identifier hs-var">dll_unadorned</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-446"></span><span>      </span><span id="local-6989586621681179818"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179818"><span class="hs-identifier hs-var">maybe_errstr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Interpreter.html#loadDLL"><span class="hs-identifier hs-var">loadDLL</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179835"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; String -&gt; String
</span><a href="GHC.Driver.Types.html#mkSOName"><span class="hs-identifier hs-var">mkSOName</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179815"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179819"><span class="hs-identifier hs-var">dll_unadorned</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-447"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179818"><span class="hs-identifier hs-var">maybe_errstr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-448"></span><span>         </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var">maybePutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;done&quot;</span></span><span>
</span><span id="line-449"></span><span>         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179814"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179814"><span class="hs-identifier hs-var">mm</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformOS"><span class="hs-identifier hs-var">platformOS</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179815"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">OS -&gt; OS -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#OSDarwin"><span class="hs-identifier hs-var">OSDarwin</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-450"></span><span>           </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; LibrarySpec -&gt; IO ()
</span><a href="#local-6989586621681179811"><span class="hs-identifier hs-var">preloadFailed</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179814"><span class="hs-identifier hs-var">mm</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179834"><span class="hs-identifier hs-var">lib_paths</span></a></span><span> </span><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179831"><span class="hs-identifier hs-var">lib_spec</span></a></span><span>
</span><span id="line-451"></span><span>         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179810"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179810"><span class="hs-identifier hs-var">mm</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-452"></span><span>           </span><span class="hs-comment">-- As a backup, on Darwin, try to also load a .so file</span><span>
</span><span id="line-453"></span><span>           </span><span class="hs-comment">-- since (apparently) some things install that way - see</span><span>
</span><span id="line-454"></span><span>           </span><span class="hs-comment">-- ticket #8770.</span><span>
</span><span id="line-455"></span><span>           </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179809"><span class="annot"><span class="annottext">libfile :: String
</span><a href="#local-6989586621681179809"><span class="hs-identifier hs-var hs-var">libfile</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;lib&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179819"><span class="hs-identifier hs-var">dll_unadorned</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;so&quot;</span></span><span>
</span><span id="line-456"></span><span>           </span><span id="local-6989586621681179807"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179807"><span class="hs-identifier hs-var">err2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Interpreter.html#loadDLL"><span class="hs-identifier hs-var">loadDLL</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179835"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179809"><span class="hs-identifier hs-var">libfile</span></a></span><span>
</span><span id="line-457"></span><span>           </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179807"><span class="hs-identifier hs-var">err2</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-458"></span><span>             </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var">maybePutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;done&quot;</span></span><span>
</span><span id="line-459"></span><span>             </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; LibrarySpec -&gt; IO ()
</span><a href="#local-6989586621681179811"><span class="hs-identifier hs-var">preloadFailed</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179810"><span class="hs-identifier hs-var">mm</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179834"><span class="hs-identifier hs-var">lib_paths</span></a></span><span> </span><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179831"><span class="hs-identifier hs-var">lib_spec</span></a></span><span>
</span><span id="line-460"></span><span>      </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179832"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-461"></span><span>
</span><span id="line-462"></span><span>    </span><span class="annot"><a href="GHC.Runtime.Linker.html#DLLPath"><span class="hs-identifier hs-type">DLLPath</span></a></span><span> </span><span id="local-6989586621681179806"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179806"><span class="hs-identifier hs-var">dll_path</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-463"></span><span>      </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681179805"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179805"><span class="hs-identifier hs-var">maybe_errstr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Interpreter.html#loadDLL"><span class="hs-identifier hs-var">loadDLL</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179835"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179806"><span class="hs-identifier hs-var">dll_path</span></a></span><span>
</span><span id="line-464"></span><span>         </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179805"><span class="hs-identifier hs-var">maybe_errstr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-465"></span><span>            </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var">maybePutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;done&quot;</span></span><span>
</span><span id="line-466"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179804"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179804"><span class="hs-identifier hs-var">mm</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; LibrarySpec -&gt; IO ()
</span><a href="#local-6989586621681179811"><span class="hs-identifier hs-var">preloadFailed</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179804"><span class="hs-identifier hs-var">mm</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179834"><span class="hs-identifier hs-var">lib_paths</span></a></span><span> </span><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179831"><span class="hs-identifier hs-var">lib_spec</span></a></span><span>
</span><span id="line-467"></span><span>         </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179832"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-468"></span><span>
</span><span id="line-469"></span><span>    </span><span class="annot"><a href="GHC.Runtime.Linker.html#Framework"><span class="hs-identifier hs-type">Framework</span></a></span><span> </span><span id="local-6989586621681179803"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179803"><span class="hs-identifier hs-var">framework</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-470"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Bool
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformUsesFrameworks"><span class="hs-identifier hs-var">platformUsesFrameworks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-471"></span><span>      </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681179802"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179802"><span class="hs-identifier hs-var">maybe_errstr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; [String] -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Linker.html#loadFramework"><span class="hs-identifier hs-var">loadFramework</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179835"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179833"><span class="hs-identifier hs-var">framework_paths</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179803"><span class="hs-identifier hs-var">framework</span></a></span><span>
</span><span id="line-472"></span><span>              </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179802"><span class="hs-identifier hs-var">maybe_errstr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-473"></span><span>                 </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var">maybePutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;done&quot;</span></span><span>
</span><span id="line-474"></span><span>                 </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179800"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179800"><span class="hs-identifier hs-var">mm</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; LibrarySpec -&gt; IO ()
</span><a href="#local-6989586621681179811"><span class="hs-identifier hs-var">preloadFailed</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179800"><span class="hs-identifier hs-var">mm</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179833"><span class="hs-identifier hs-var">framework_paths</span></a></span><span> </span><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179831"><span class="hs-identifier hs-var">lib_spec</span></a></span><span>
</span><span id="line-475"></span><span>              </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179832"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-476"></span><span>      </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO PersistentLinkerState
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;preloadLib Framework&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-477"></span><span>
</span><span id="line-478"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-479"></span><span>    </span><span id="local-6989586621681179830"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179835"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-480"></span><span>
</span><span id="line-481"></span><span>    </span><span id="local-6989586621681179815"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681179815"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-482"></span><span>
</span><span id="line-483"></span><span>    </span><span class="annot"><a href="#local-6989586621681179811"><span class="hs-identifier hs-type">preloadFailed</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-type">LibrarySpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-484"></span><span>    </span><span id="local-6989586621681179811"><span class="annot"><span class="annottext">preloadFailed :: String -&gt; [String] -&gt; LibrarySpec -&gt; IO ()
</span><a href="#local-6989586621681179811"><span class="hs-identifier hs-var hs-var">preloadFailed</span></a></span></span><span> </span><span id="local-6989586621681179799"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179799"><span class="hs-identifier hs-var">sys_errmsg</span></a></span></span><span> </span><span id="local-6989586621681179798"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179798"><span class="hs-identifier hs-var">paths</span></a></span></span><span> </span><span id="local-6989586621681179797"><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179797"><span class="hs-identifier hs-var">spec</span></a></span></span><span>
</span><span id="line-485"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStr"><span class="hs-identifier hs-var">maybePutStr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179830"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;failed.\n&quot;</span></span><span>
</span><span id="line-486"></span><span>            </span><span class="annot"><span class="annottext">GhcException -&gt; IO ()
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="annot"><span class="annottext">(GhcException -&gt; IO ()) -&gt; GhcException -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-487"></span><span>              </span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#CmdLineError"><span class="hs-identifier hs-var">CmdLineError</span></a></span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-488"></span><span>                    </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;user specified .o/.so/.DLL could not be loaded (&quot;</span></span><span>
</span><span id="line-489"></span><span>                    </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179799"><span class="hs-identifier hs-var">sys_errmsg</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;)\nWhilst trying to load:  &quot;</span></span><span>
</span><span id="line-490"></span><span>                    </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">LibrarySpec -&gt; String
</span><a href="GHC.Runtime.Linker.html#showLS"><span class="hs-identifier hs-var">showLS</span></a></span><span> </span><span class="annot"><span class="annottext">LibrarySpec
</span><a href="#local-6989586621681179797"><span class="hs-identifier hs-var">spec</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\nAdditional directories searched:&quot;</span></span><span>
</span><span id="line-491"></span><span>                    </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179798"><span class="hs-identifier hs-var">paths</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; (none)&quot;</span></span><span> </span><span class="hs-keyword">else</span><span>
</span><span id="line-492"></span><span>                        </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; String
forall a. [a] -&gt; [[a]] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#intercalate"><span class="hs-identifier hs-var">intercalate</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\n&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;   &quot;</span></span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179798"><span class="hs-identifier hs-var">paths</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-493"></span><span>
</span><span id="line-494"></span><span>    </span><span class="hs-comment">-- Not interested in the paths in the static case.</span><span>
</span><span id="line-495"></span><span>    </span><span id="local-6989586621681179825"><span class="annot"><span class="annottext">preload_statics :: p -&gt; [String] -&gt; IO (Bool, PersistentLinkerState)
</span><a href="#local-6989586621681179825"><span class="hs-identifier hs-var hs-var">preload_statics</span></a></span></span><span> </span><span id="local-6989586621681179783"><span class="annot"><span class="annottext">p
</span><a href="#local-6989586621681179783"><span class="hs-identifier hs-var">_paths</span></a></span></span><span> </span><span id="local-6989586621681179782"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179782"><span class="hs-identifier hs-var">names</span></a></span></span><span>
</span><span id="line-496"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681179781"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179781"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; Bool
forall (t :: * -&gt; *). Foldable t =&gt; t Bool -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#or"><span class="hs-identifier hs-var">or</span></a></span><span> </span><span class="annot"><span class="annottext">([Bool] -&gt; Bool) -&gt; IO [Bool] -&gt; IO Bool
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO Bool) -&gt; [String] -&gt; IO [Bool]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; IO Bool
</span><a href="../../directory/src/System.Directory.html#doesFileExist"><span class="hs-identifier hs-var">doesFileExist</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179782"><span class="hs-identifier hs-var">names</span></a></span><span>
</span><span id="line-497"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179781"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">(Bool, PersistentLinkerState) -&gt; IO (Bool, PersistentLinkerState)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179832"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-498"></span><span>                     </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Driver.Ways.html#hostIsDynamic"><span class="hs-identifier hs-var">hostIsDynamic</span></a></span><span>
</span><span id="line-499"></span><span>                             </span><span class="hs-keyword">then</span><span>  </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681179777"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179777"><span class="hs-identifier hs-var">pls1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; PersistentLinkerState -&gt; [String] -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#dynLoadObjs"><span class="hs-identifier hs-var">dynLoadObjs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179835"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179832"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179782"><span class="hs-identifier hs-var">names</span></a></span><span>
</span><span id="line-500"></span><span>                                      </span><span class="annot"><span class="annottext">(Bool, PersistentLinkerState) -&gt; IO (Bool, PersistentLinkerState)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179777"><span class="hs-identifier hs-var">pls1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-501"></span><span>                             </span><span class="hs-keyword">else</span><span>  </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO ()) -&gt; [String] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Interpreter.html#loadObj"><span class="hs-identifier hs-var">loadObj</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179835"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179782"><span class="hs-identifier hs-var">names</span></a></span><span>
</span><span id="line-502"></span><span>                                      </span><span class="annot"><span class="annottext">(Bool, PersistentLinkerState) -&gt; IO (Bool, PersistentLinkerState)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179832"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-503"></span><span>
</span><span id="line-504"></span><span>    </span><span id="local-6989586621681179821"><span class="annot"><span class="annottext">preload_static_archive :: p -&gt; String -&gt; IO Bool
</span><a href="#local-6989586621681179821"><span class="hs-identifier hs-var hs-var">preload_static_archive</span></a></span></span><span> </span><span id="local-6989586621681179770"><span class="annot"><span class="annottext">p
</span><a href="#local-6989586621681179770"><span class="hs-identifier hs-var">_paths</span></a></span></span><span> </span><span id="local-6989586621681179769"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179769"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-505"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681179768"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179768"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO Bool
</span><a href="../../directory/src/System.Directory.html#doesFileExist"><span class="hs-identifier hs-var">doesFileExist</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179769"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-506"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179768"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; IO Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-507"></span><span>                     </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Driver.Ways.html#hostIsDynamic"><span class="hs-identifier hs-var">hostIsDynamic</span></a></span><span>
</span><span id="line-508"></span><span>                                 </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO ()
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="annot"><span class="annottext">(GhcException -&gt; IO ()) -&gt; GhcException -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-509"></span><span>                                      </span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#CmdLineError"><span class="hs-identifier hs-var">CmdLineError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179767"><span class="hs-identifier hs-var">dynamic_msg</span></a></span><span>
</span><span id="line-510"></span><span>                                 </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Interpreter.html#loadArchive"><span class="hs-identifier hs-var">loadArchive</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179835"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179769"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-511"></span><span>                             </span><span class="annot"><span class="annottext">Bool -&gt; IO Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-512"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-513"></span><span>        </span><span id="local-6989586621681179767"><span class="annot"><span class="annottext">dynamic_msg :: String
</span><a href="#local-6989586621681179767"><span class="hs-identifier hs-var hs-var">dynamic_msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
</span><a href="../../base/src/Data.OldList.html#unlines"><span class="hs-identifier hs-var">unlines</span></a></span><span>
</span><span id="line-514"></span><span>          </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;User-specified static library could not be loaded (&quot;</span></span><span>
</span><span id="line-515"></span><span>            </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179769"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;)&quot;</span></span><span>
</span><span id="line-516"></span><span>          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Loading static libraries is not supported in this configuration.&quot;</span></span><span>
</span><span id="line-517"></span><span>          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Try using a dynamic library instead.&quot;</span></span><span>
</span><span id="line-518"></span><span>          </span><span class="hs-special">]</span><span>
</span><span id="line-519"></span><span>
</span><span id="line-520"></span><span>
</span><span id="line-521"></span><span class="hs-comment">{- **********************************************************************

                        Link a byte-code expression

  ********************************************************************* -}</span><span>
</span><span id="line-526"></span><span>
</span><span id="line-527"></span><span class="hs-comment">-- | Link a single expression, /including/ first linking packages and</span><span>
</span><span id="line-528"></span><span class="hs-comment">-- modules that this expression depends on.</span><span>
</span><span id="line-529"></span><span class="hs-comment">--</span><span>
</span><span id="line-530"></span><span class="hs-comment">-- Raises an IO exception ('ProgramError') if it can't find a compiled</span><span>
</span><span id="line-531"></span><span class="hs-comment">-- version of the dependents to link.</span><span>
</span><span id="line-532"></span><span class="hs-comment">--</span><span>
</span><span id="line-533"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkExpr"><span class="hs-identifier hs-type">linkExpr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.ByteCode.Types.html#UnlinkedBCO"><span class="hs-identifier hs-type">UnlinkedBCO</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#ForeignHValue"><span class="hs-identifier hs-type">ForeignHValue</span></a></span><span>
</span><span id="line-534"></span><span id="linkExpr"><span class="annot"><span class="annottext">linkExpr :: HscEnv -&gt; SrcSpan -&gt; UnlinkedBCO -&gt; IO ForeignHValue
</span><a href="GHC.Runtime.Linker.html#linkExpr"><span class="hs-identifier hs-var hs-var">linkExpr</span></a></span></span><span> </span><span id="local-6989586621681179765"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179765"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179764"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179764"><span class="hs-identifier hs-var">span</span></a></span></span><span> </span><span id="local-6989586621681179763"><span class="annot"><span class="annottext">UnlinkedBCO
</span><a href="#local-6989586621681179763"><span class="hs-identifier hs-var">root_ul_bco</span></a></span></span><span>
</span><span id="line-535"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-536"></span><span>     </span><span class="hs-comment">-- Initialise the linker (if it's not been done already)</span><span>
</span><span id="line-537"></span><span>   </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#initDynLinker"><span class="hs-identifier hs-var">initDynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179765"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-538"></span><span>
</span><span id="line-539"></span><span>     </span><span class="hs-comment">-- Extract the DynLinker value for passing into required places</span><span>
</span><span id="line-540"></span><span>   </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179762"><span class="annot"><span class="annottext">dl :: DynLinker
</span><a href="#local-6989586621681179762"><span class="hs-identifier hs-var hs-var">dl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynLinker
</span><a href="GHC.Driver.Types.html#hsc_dynLinker"><span class="hs-identifier hs-var hs-var">hsc_dynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179765"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-541"></span><span>
</span><span id="line-542"></span><span>     </span><span class="hs-comment">-- Take lock for the actual work.</span><span>
</span><span id="line-543"></span><span>   </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState
    -&gt; IO (PersistentLinkerState, ForeignHValue))
-&gt; IO ForeignHValue
forall a.
DynLinker
-&gt; (PersistentLinkerState -&gt; IO (PersistentLinkerState, a)) -&gt; IO a
</span><a href="GHC.Runtime.Linker.html#modifyPLS"><span class="hs-identifier hs-var">modifyPLS</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179762"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState
  -&gt; IO (PersistentLinkerState, ForeignHValue))
 -&gt; IO ForeignHValue)
-&gt; (PersistentLinkerState
    -&gt; IO (PersistentLinkerState, ForeignHValue))
-&gt; IO ForeignHValue
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681179761"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179761"><span class="hs-identifier hs-var">pls0</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-544"></span><span>
</span><span id="line-545"></span><span>     </span><span class="hs-comment">-- Link the packages and modules required</span><span>
</span><span id="line-546"></span><span>   </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179760"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179760"><span class="hs-identifier hs-var">pls</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179759"><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179759"><span class="hs-identifier hs-var">ok</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; PersistentLinkerState
-&gt; SrcSpan
-&gt; [Module]
-&gt; IO (PersistentLinkerState, SuccessFlag)
</span><a href="GHC.Runtime.Linker.html#linkDependencies"><span class="hs-identifier hs-var">linkDependencies</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179765"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179761"><span class="hs-identifier hs-var">pls0</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179764"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681179758"><span class="hs-identifier hs-var">needed_mods</span></a></span><span>
</span><span id="line-547"></span><span>   </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">SuccessFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#failed"><span class="hs-identifier hs-var">failed</span></a></span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179759"><span class="hs-identifier hs-var">ok</span></a></span><span> </span><span class="hs-keyword">then</span><span>
</span><span id="line-548"></span><span>        </span><span class="annot"><span class="annottext">GhcException -&gt; IO (PersistentLinkerState, ForeignHValue)
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-549"></span><span>     </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-550"></span><span>
</span><span id="line-551"></span><span>     </span><span class="hs-comment">-- Link the expression itself</span><span>
</span><span id="line-552"></span><span>     </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179757"><span class="annot"><span class="annottext">ie :: ItblEnv
</span><a href="#local-6989586621681179757"><span class="hs-identifier hs-var hs-var">ie</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; ItblEnv
</span><a href="GHC.Runtime.Linker.Types.html#itbl_env"><span class="hs-identifier hs-var hs-var">itbl_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179760"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-553"></span><span>         </span><span id="local-6989586621681179756"><span class="annot"><span class="annottext">ce :: ClosureEnv
</span><a href="#local-6989586621681179756"><span class="hs-identifier hs-var hs-var">ce</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var hs-var">closure_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179760"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-554"></span><span>
</span><span id="line-555"></span><span>     </span><span class="hs-comment">-- Link the necessary packages and linkables</span><span>
</span><span id="line-556"></span><span>
</span><span id="line-557"></span><span>   </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179753"><span class="annot"><span class="annottext">nobreakarray :: a
</span><a href="#local-6989586621681179753"><span class="hs-identifier hs-var hs-var">nobreakarray</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;no break array&quot;</span></span><span>
</span><span id="line-558"></span><span>         </span><span id="local-6989586621681179750"><span class="annot"><span class="annottext">bco_ix :: NameEnv Int
</span><a href="#local-6989586621681179750"><span class="hs-identifier hs-var hs-var">bco_ix</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, Int)] -&gt; NameEnv Int
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnlinkedBCO -&gt; Name
</span><a href="GHC.ByteCode.Types.html#unlinkedBCOName"><span class="hs-identifier hs-var hs-var">unlinkedBCOName</span></a></span><span> </span><span class="annot"><span class="annottext">UnlinkedBCO
</span><a href="#local-6989586621681179763"><span class="hs-identifier hs-var">root_ul_bco</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-559"></span><span>   </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681179747"><span class="annot"><span class="annottext">ResolvedBCO
</span><a href="#local-6989586621681179747"><span class="hs-identifier hs-var">resolved</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; ItblEnv
-&gt; ClosureEnv
-&gt; NameEnv Int
-&gt; RemoteRef BreakArray
-&gt; UnlinkedBCO
-&gt; IO ResolvedBCO
</span><a href="GHC.ByteCode.Linker.html#linkBCO"><span class="hs-identifier hs-var">linkBCO</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179765"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ItblEnv
</span><a href="#local-6989586621681179757"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179756"><span class="hs-identifier hs-var">ce</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv Int
</span><a href="#local-6989586621681179750"><span class="hs-identifier hs-var">bco_ix</span></a></span><span> </span><span class="annot"><span class="annottext">RemoteRef BreakArray
forall a. a
</span><a href="#local-6989586621681179753"><span class="hs-identifier hs-var">nobreakarray</span></a></span><span> </span><span class="annot"><span class="annottext">UnlinkedBCO
</span><a href="#local-6989586621681179763"><span class="hs-identifier hs-var">root_ul_bco</span></a></span><span>
</span><span id="line-560"></span><span>   </span><span class="hs-special">;</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681179745"><span class="annot"><span class="annottext">HValueRef
</span><a href="#local-6989586621681179745"><span class="hs-identifier hs-var">root_hvref</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; [ResolvedBCO] -&gt; IO [HValueRef]
</span><a href="GHC.Runtime.Interpreter.html#createBCOs"><span class="hs-identifier hs-var">createBCOs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179765"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ResolvedBCO
</span><a href="#local-6989586621681179747"><span class="hs-identifier hs-var">resolved</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-561"></span><span>   </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681179743"><span class="annot"><span class="annottext">ForeignHValue
</span><a href="#local-6989586621681179743"><span class="hs-identifier hs-var">fhv</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; HValueRef -&gt; IO ForeignHValue
forall a. HscEnv -&gt; RemoteRef a -&gt; IO (ForeignRef a)
</span><a href="GHC.Runtime.Interpreter.html#mkFinalizedHValue"><span class="hs-identifier hs-var">mkFinalizedHValue</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179765"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">HValueRef
</span><a href="#local-6989586621681179745"><span class="hs-identifier hs-var">root_hvref</span></a></span><span>
</span><span id="line-562"></span><span>   </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(PersistentLinkerState, ForeignHValue)
-&gt; IO (PersistentLinkerState, ForeignHValue)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179760"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ForeignHValue
</span><a href="#local-6989586621681179743"><span class="hs-identifier hs-var">fhv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-563"></span><span>   </span><span class="hs-special">}</span><span class="hs-special">}</span><span class="hs-special">}</span><span>
</span><span id="line-564"></span><span>   </span><span class="hs-keyword">where</span><span>
</span><span id="line-565"></span><span>     </span><span id="local-6989586621681179742"><span class="annot"><span class="annottext">free_names :: [Name]
</span><a href="#local-6989586621681179742"><span class="hs-identifier hs-var hs-var">free_names</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqDSet Name -&gt; [Name]
forall a. UniqDSet a -&gt; [a]
</span><a href="GHC.Types.Unique.DSet.html#uniqDSetToList"><span class="hs-identifier hs-var">uniqDSetToList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnlinkedBCO -&gt; UniqDSet Name
</span><a href="GHC.ByteCode.Asm.html#bcoFreeNames"><span class="hs-identifier hs-var">bcoFreeNames</span></a></span><span> </span><span class="annot"><span class="annottext">UnlinkedBCO
</span><a href="#local-6989586621681179763"><span class="hs-identifier hs-var">root_ul_bco</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-566"></span><span>
</span><span id="line-567"></span><span>     </span><span class="annot"><a href="#local-6989586621681179758"><span class="hs-identifier hs-type">needed_mods</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-568"></span><span>     </span><span id="local-6989586621681179758"><span class="annot"><span class="annottext">needed_mods :: [Module]
</span><a href="#local-6989586621681179758"><span class="hs-identifier hs-var hs-var">needed_mods</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Module
Name -&gt; Module
</span><a href="GHC.Types.Name.html#nameModule"><span class="hs-identifier hs-var">nameModule</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179739"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681179739"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179739"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681179742"><span class="hs-identifier hs-var">free_names</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-569"></span><span>                     </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isExternalName"><span class="hs-identifier hs-var">isExternalName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179739"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span>      </span><span class="hs-comment">-- Names from other modules</span><span>
</span><span id="line-570"></span><span>                     </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isWiredInName"><span class="hs-identifier hs-var">isWiredInName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179739"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- Exclude wired-in names</span><span>
</span><span id="line-571"></span><span>                   </span><span class="hs-special">]</span><span>                        </span><span class="hs-comment">-- (see note below)</span><span>
</span><span id="line-572"></span><span>        </span><span class="hs-comment">-- Exclude wired-in names because we may not have read</span><span>
</span><span id="line-573"></span><span>        </span><span class="hs-comment">-- their interface files, so getLinkDeps will fail</span><span>
</span><span id="line-574"></span><span>        </span><span class="hs-comment">-- All wired-in names are in the base package, which we link</span><span>
</span><span id="line-575"></span><span>        </span><span class="hs-comment">-- by default, so we can safely ignore them here.</span><span>
</span><span id="line-576"></span><span>
</span><span id="line-577"></span><span id="local-6989586621681180534"><span class="annot"><a href="GHC.Runtime.Linker.html#dieWith"><span class="hs-identifier hs-type">dieWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#MsgDoc"><span class="hs-identifier hs-type">MsgDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621681180534"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-578"></span><span id="dieWith"><span class="annot"><span class="annottext">dieWith :: forall a. DynFlags -&gt; SrcSpan -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Linker.html#dieWith"><span class="hs-identifier hs-var hs-var">dieWith</span></a></span></span><span> </span><span id="local-6989586621681179735"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179735"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681179734"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179734"><span class="hs-identifier hs-var">span</span></a></span></span><span> </span><span id="local-6989586621681179733"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179733"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO a
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179735"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Severity -&gt; SrcSpan -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Error.html#mkLocMessage"><span class="hs-identifier hs-var">mkLocMessage</span></a></span><span> </span><span class="annot"><span class="annottext">Severity
</span><a href="GHC.Utils.Error.html#SevFatal"><span class="hs-identifier hs-var">SevFatal</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179734"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179733"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-579"></span><span>
</span><span id="line-580"></span><span>
</span><span id="line-581"></span><span class="annot"><a href="GHC.Runtime.Linker.html#checkNonStdWay"><span class="hs-identifier hs-type">checkNonStdWay</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-582"></span><span id="checkNonStdWay"><span class="annot"><span class="annottext">checkNonStdWay :: HscEnv -&gt; SrcSpan -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Linker.html#checkNonStdWay"><span class="hs-identifier hs-var hs-var">checkNonStdWay</span></a></span></span><span> </span><span id="local-6989586621681179729"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179729"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179728"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179728"><span class="hs-identifier hs-var">srcspan</span></a></span></span><span>
</span><span id="line-583"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#ExternalInterp"><span class="hs-identifier hs-type">ExternalInterp</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Maybe Interp
</span><a href="GHC.Driver.Types.html#hsc_interp"><span class="hs-identifier hs-var hs-var">hsc_interp</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179729"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; IO (Maybe String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-584"></span><span>    </span><span class="hs-comment">-- with -fexternal-interpreter we load the .o files, whatever way</span><span>
</span><span id="line-585"></span><span>    </span><span class="hs-comment">-- they were built.  If they were built for a non-std way, then</span><span>
</span><span id="line-586"></span><span>    </span><span class="hs-comment">-- we will use the appropriate variant of the iserv binary to load them.</span><span>
</span><span id="line-587"></span><span>
</span><span id="line-588"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Set Way
</span><a href="GHC.Driver.Ways.html#hostFullWays"><span class="hs-identifier hs-var">hostFullWays</span></a></span><span> </span><span class="annot"><span class="annottext">Set Way -&gt; Set Way -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Set Way
</span><a href="#local-6989586621681179724"><span class="hs-identifier hs-var">targetFullWays</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; IO (Maybe String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-589"></span><span>    </span><span class="hs-comment">-- Only if we are compiling with the same ways as GHC is built</span><span>
</span><span id="line-590"></span><span>    </span><span class="hs-comment">-- with, can we dynamically load those object files. (see #3604)</span><span>
</span><span id="line-591"></span><span>
</span><span id="line-592"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String
</span><a href="GHC.Driver.Session.html#objectSuf"><span class="hs-identifier hs-var hs-var">objectSuf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179729"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="GHC.Runtime.Linker.html#normalObjectSuffix"><span class="hs-identifier hs-var">normalObjectSuffix</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Set Way -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Set Way
</span><a href="#local-6989586621681179724"><span class="hs-identifier hs-var">targetFullWays</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-593"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Linker.html#failNonStd"><span class="hs-identifier hs-var">failNonStd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179729"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179728"><span class="hs-identifier hs-var">srcspan</span></a></span><span>
</span><span id="line-594"></span><span>
</span><span id="line-595"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; IO (Maybe String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Maybe String
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179720"><span class="hs-identifier hs-var">hostWayTag</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;o&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-596"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-597"></span><span>    </span><span id="local-6989586621681179724"><span class="annot"><span class="annottext">targetFullWays :: Set Way
</span><a href="#local-6989586621681179724"><span class="hs-identifier hs-var hs-var">targetFullWays</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Way -&gt; Bool) -&gt; Set Way -&gt; Set Way
forall a. (a -&gt; Bool) -&gt; Set a -&gt; Set a
</span><a href="../../containers/src/Data.Set.Internal.html#filter"><span class="hs-identifier hs-var">Set.filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Way -&gt; Bool) -&gt; Way -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Way -&gt; Bool
</span><a href="GHC.Driver.Ways.html#wayRTSOnly"><span class="hs-identifier hs-var">wayRTSOnly</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Set Way
</span><a href="GHC.Driver.Session.html#ways"><span class="hs-identifier hs-var hs-var">ways</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179729"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-598"></span><span>    </span><span id="local-6989586621681179720"><span class="annot"><span class="annottext">hostWayTag :: String
</span><a href="#local-6989586621681179720"><span class="hs-identifier hs-var hs-var">hostWayTag</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Set Way -&gt; String
</span><a href="GHC.Driver.Ways.html#waysTag"><span class="hs-identifier hs-var">waysTag</span></a></span><span> </span><span class="annot"><span class="annottext">Set Way
</span><a href="GHC.Driver.Ways.html#hostFullWays"><span class="hs-identifier hs-var">hostFullWays</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-599"></span><span>                  </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-600"></span><span>                  </span><span id="local-6989586621681179715"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179715"><span class="hs-identifier hs-var">tag</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179715"><span class="hs-identifier hs-var">tag</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;_&quot;</span></span><span>
</span><span id="line-601"></span><span>
</span><span id="line-602"></span><span class="annot"><a href="GHC.Runtime.Linker.html#normalObjectSuffix"><span class="hs-identifier hs-type">normalObjectSuffix</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-603"></span><span id="normalObjectSuffix"><span class="annot"><span class="annottext">normalObjectSuffix :: String
</span><a href="GHC.Runtime.Linker.html#normalObjectSuffix"><span class="hs-identifier hs-var hs-var">normalObjectSuffix</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Phase -&gt; String
</span><a href="GHC.Driver.Phases.html#phaseInputExt"><span class="hs-identifier hs-var">phaseInputExt</span></a></span><span> </span><span class="annot"><span class="annottext">Phase
</span><a href="GHC.Driver.Phases.html#StopLn"><span class="hs-identifier hs-var">StopLn</span></a></span><span>
</span><span id="line-604"></span><span>
</span><span id="line-605"></span><span class="annot"><a href="GHC.Runtime.Linker.html#failNonStd"><span class="hs-identifier hs-type">failNonStd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-606"></span><span id="failNonStd"><span class="annot"><span class="annottext">failNonStd :: DynFlags -&gt; SrcSpan -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Linker.html#failNonStd"><span class="hs-identifier hs-var hs-var">failNonStd</span></a></span></span><span> </span><span id="local-6989586621681179712"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179712"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681179711"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179711"><span class="hs-identifier hs-var">srcspan</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; SDoc -&gt; IO (Maybe String)
forall a. DynFlags -&gt; SrcSpan -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Linker.html#dieWith"><span class="hs-identifier hs-var">dieWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179712"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179711"><span class="hs-identifier hs-var">srcspan</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO (Maybe String)) -&gt; SDoc -&gt; IO (Maybe String)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-607"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Cannot load&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179710"><span class="hs-identifier hs-var">compWay</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-608"></span><span>     </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;objects when GHC is built&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179709"><span class="hs-identifier hs-var">ghciWay</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-609"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;To fix this, either:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-610"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  (1) Use -fexternal-interpreter, or&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-611"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  (2) Build the program twice: once&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-612"></span><span>                       </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179709"><span class="hs-identifier hs-var">ghciWay</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;, and then&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-613"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;      with&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179710"><span class="hs-identifier hs-var">compWay</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-614"></span><span>     </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;using -osuf to set a different object file suffix.&quot;</span></span><span>
</span><span id="line-615"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681179710"><span class="annot"><span class="annottext">compWay :: SDoc
</span><a href="#local-6989586621681179710"><span class="hs-identifier hs-var hs-var">compWay</span></a></span></span><span>
</span><span id="line-616"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Way
</span><a href="GHC.Driver.Ways.html#WayDyn"><span class="hs-identifier hs-var">WayDyn</span></a></span><span> </span><span class="annot"><span class="annottext">Way -&gt; Set Way -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Set Way
</span><a href="GHC.Driver.Session.html#ways"><span class="hs-identifier hs-var hs-var">ways</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179712"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-dynamic&quot;</span></span><span>
</span><span id="line-617"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Way
</span><a href="GHC.Driver.Ways.html#WayProf"><span class="hs-identifier hs-var">WayProf</span></a></span><span> </span><span class="annot"><span class="annottext">Way -&gt; Set Way -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Set Way
</span><a href="GHC.Driver.Session.html#ways"><span class="hs-identifier hs-var hs-var">ways</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179712"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-prof&quot;</span></span><span>
</span><span id="line-618"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;normal&quot;</span></span><span>
</span><span id="line-619"></span><span>          </span><span id="local-6989586621681179709"><span class="annot"><span class="annottext">ghciWay :: SDoc
</span><a href="#local-6989586621681179709"><span class="hs-identifier hs-var hs-var">ghciWay</span></a></span></span><span>
</span><span id="line-620"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Driver.Ways.html#hostIsDynamic"><span class="hs-identifier hs-var">hostIsDynamic</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;with -dynamic&quot;</span></span><span>
</span><span id="line-621"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Driver.Ways.html#hostIsProfiled"><span class="hs-identifier hs-var">hostIsProfiled</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;with -prof&quot;</span></span><span>
</span><span id="line-622"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;the normal way&quot;</span></span><span>
</span><span id="line-623"></span><span>
</span><span id="line-624"></span><span class="annot"><a href="GHC.Runtime.Linker.html#getLinkDeps"><span class="hs-identifier hs-type">getLinkDeps</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HomePackageTable"><span class="hs-identifier hs-type">HomePackageTable</span></a></span><span>
</span><span id="line-625"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-626"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>                   </span><span class="hs-comment">-- replace object suffices?</span><span>
</span><span id="line-627"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span>                          </span><span class="hs-comment">-- for error messages</span><span>
</span><span id="line-628"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">]</span><span>                         </span><span class="hs-comment">-- If you need these</span><span>
</span><span id="line-629"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>     </span><span class="hs-comment">-- ... then link these first</span><span>
</span><span id="line-630"></span><span class="hs-comment">-- Fails with an IO exception if it can't find enough files</span><span>
</span><span id="line-631"></span><span>
</span><span id="line-632"></span><span id="getLinkDeps"><span class="annot"><span class="annottext">getLinkDeps :: HscEnv
-&gt; HomePackageTable
-&gt; PersistentLinkerState
-&gt; Maybe String
-&gt; SrcSpan
-&gt; [Module]
-&gt; IO ([Linkable], [UnitId])
</span><a href="GHC.Runtime.Linker.html#getLinkDeps"><span class="hs-identifier hs-var hs-var">getLinkDeps</span></a></span></span><span> </span><span id="local-6989586621681179698"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179698"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179697"><span class="annot"><span class="annottext">HomePackageTable
</span><a href="#local-6989586621681179697"><span class="hs-identifier hs-var">hpt</span></a></span></span><span> </span><span id="local-6989586621681179696"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179696"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span id="local-6989586621681179695"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179695"><span class="hs-identifier hs-var">replace_osuf</span></a></span></span><span> </span><span id="local-6989586621681179694"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179694"><span class="hs-identifier hs-var">span</span></a></span></span><span> </span><span id="local-6989586621681179693"><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681179693"><span class="hs-identifier hs-var">mods</span></a></span></span><span>
</span><span id="line-633"></span><span class="hs-comment">-- Find all the packages and linkables that a set of modules depends on</span><span>
</span><span id="line-634"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-635"></span><span>        </span><span class="hs-comment">-- 1.  Find the dependent home-pkg-modules/packages from each iface</span><span>
</span><span id="line-636"></span><span>        </span><span class="hs-comment">-- (omitting modules from the interactive package, which is already linked)</span><span>
</span><span id="line-637"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179692"><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681179692"><span class="hs-identifier hs-var">mods_s</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179691"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179691"><span class="hs-identifier hs-var">pkgs_s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Module]
-&gt; UniqDSet ModuleName
-&gt; UniqDSet UnitId
-&gt; IO ([ModuleName], [UnitId])
</span><a href="#local-6989586621681179690"><span class="hs-identifier hs-var">follow_deps</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Module -&gt; Bool) -&gt; [Module] -&gt; [Module]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterOut"><span class="hs-identifier hs-var">filterOut</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; Bool
</span><a href="GHC.Unit.Types.html#isInteractiveModule"><span class="hs-identifier hs-var">isInteractiveModule</span></a></span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681179693"><span class="hs-identifier hs-var">mods</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-638"></span><span>                                        </span><span class="annot"><span class="annottext">UniqDSet ModuleName
forall a. UniqDSet a
</span><a href="GHC.Types.Unique.DSet.html#emptyUniqDSet"><span class="hs-identifier hs-var">emptyUniqDSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet UnitId
forall a. UniqDSet a
</span><a href="GHC.Types.Unique.DSet.html#emptyUniqDSet"><span class="hs-identifier hs-var">emptyUniqDSet</span></a></span><span class="hs-special">;</span><span>
</span><span id="line-639"></span><span>
</span><span id="line-640"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-641"></span><span>        </span><span class="hs-comment">-- 2.  Exclude ones already linked</span><span>
</span><span id="line-642"></span><span>        </span><span class="hs-comment">--      Main reason: avoid findModule calls in get_linkable</span><span>
</span><span id="line-643"></span><span>            </span><span id="local-6989586621681179684"><span class="annot"><span class="annottext">mods_needed :: [ModuleName]
</span><a href="#local-6989586621681179684"><span class="hs-identifier hs-var hs-var">mods_needed</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681179692"><span class="hs-identifier hs-var">mods_s</span></a></span><span> </span><span class="annot"><span class="annottext">[ModuleName] -&gt; [ModuleName] -&gt; [ModuleName]
forall a. Ord a =&gt; [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Data.List.SetOps.html#minusList"><span class="hs-operator hs-var">`minusList`</span></a></span><span> </span><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681179682"><span class="hs-identifier hs-var">linked_mods</span></a></span><span>     </span><span class="hs-special">;</span><span>
</span><span id="line-644"></span><span>            </span><span id="local-6989586621681179679"><span class="annot"><span class="annottext">pkgs_needed :: [UnitId]
</span><a href="#local-6989586621681179679"><span class="hs-identifier hs-var hs-var">pkgs_needed</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179691"><span class="hs-identifier hs-var">pkgs_s</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId] -&gt; [UnitId] -&gt; [UnitId]
forall a. Ord a =&gt; [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Data.List.SetOps.html#minusList"><span class="hs-operator hs-var">`minusList`</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [UnitId]
</span><a href="GHC.Runtime.Linker.Types.html#pkgs_loaded"><span class="hs-identifier hs-var hs-var">pkgs_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179696"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="hs-special">;</span><span>
</span><span id="line-645"></span><span>
</span><span id="line-646"></span><span>            </span><span id="local-6989586621681179682"><span class="annot"><span class="annottext">linked_mods :: [ModuleName]
</span><a href="#local-6989586621681179682"><span class="hs-identifier hs-var hs-var">linked_mods</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Linkable -&gt; ModuleName) -&gt; [Linkable] -&gt; [ModuleName]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span class="annot"><span class="annottext">(Module -&gt; ModuleName)
-&gt; (Linkable -&gt; Module) -&gt; Linkable -&gt; ModuleName
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span class="annot"><span class="annottext">Linkable -&gt; Module
</span><a href="GHC.Runtime.Linker.Types.html#linkableModule"><span class="hs-identifier hs-var hs-var">linkableModule</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-647"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#objs_loaded"><span class="hs-identifier hs-var hs-var">objs_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179696"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; [Linkable] -&gt; [Linkable]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#bcos_loaded"><span class="hs-identifier hs-var hs-var">bcos_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179696"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-648"></span><span>
</span><span id="line-649"></span><span>        </span><span class="hs-comment">-- 3.  For each dependent module, find its linkable</span><span>
</span><span id="line-650"></span><span>        </span><span class="hs-comment">--     This will either be in the HPT or (in the case of one-shot</span><span>
</span><span id="line-651"></span><span>        </span><span class="hs-comment">--     compilation) we may need to use maybe_getFileLinkable</span><span>
</span><span id="line-652"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681179676"><span class="annot"><span class="annottext">osuf :: String
</span><a href="#local-6989586621681179676"><span class="hs-identifier hs-var hs-var">osuf</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String
</span><a href="GHC.Driver.Session.html#objectSuf"><span class="hs-identifier hs-var hs-var">objectSuf</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179675"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-653"></span><span>      </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681179674"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179674"><span class="hs-identifier hs-var">lnks_needed</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(ModuleName -&gt; IO Linkable) -&gt; [ModuleName] -&gt; IO [Linkable]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; ModuleName -&gt; IO Linkable
</span><a href="#local-6989586621681179673"><span class="hs-identifier hs-var">get_linkable</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179676"><span class="hs-identifier hs-var">osuf</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681179684"><span class="hs-identifier hs-var">mods_needed</span></a></span><span>
</span><span id="line-654"></span><span>
</span><span id="line-655"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([Linkable], [UnitId]) -&gt; IO ([Linkable], [UnitId])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179674"><span class="hs-identifier hs-var">lnks_needed</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179679"><span class="hs-identifier hs-var">pkgs_needed</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-656"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-657"></span><span>    </span><span id="local-6989586621681179675"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681179675"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179698"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-658"></span><span>    </span><span id="local-6989586621681179672"><span class="annot"><span class="annottext">this_pkg :: Unit
</span><a href="#local-6989586621681179672"><span class="hs-identifier hs-var hs-var">this_pkg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Unit
</span><a href="GHC.Driver.Session.html#homeUnit"><span class="hs-identifier hs-var">homeUnit</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179675"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-659"></span><span>
</span><span id="line-660"></span><span>        </span><span class="hs-comment">-- The ModIface contains the transitive closure of the module dependencies</span><span>
</span><span id="line-661"></span><span>        </span><span class="hs-comment">-- within the current package, *except* for boot modules: if we encounter</span><span>
</span><span id="line-662"></span><span>        </span><span class="hs-comment">-- a boot module, we have to find its real interface and discover the</span><span>
</span><span id="line-663"></span><span>        </span><span class="hs-comment">-- dependencies of that.  Hence we need to traverse the dependency</span><span>
</span><span id="line-664"></span><span>        </span><span class="hs-comment">-- tree recursively.  See bug #936, testcase ghci/prog007.</span><span>
</span><span id="line-665"></span><span>    </span><span class="annot"><a href="#local-6989586621681179690"><span class="hs-identifier hs-type">follow_deps</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">]</span><span>             </span><span class="hs-comment">-- modules to follow</span><span>
</span><span id="line-666"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.DSet.html#UniqDSet"><span class="hs-identifier hs-type">UniqDSet</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span>         </span><span class="hs-comment">-- accum. module dependencies</span><span>
</span><span id="line-667"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.DSet.html#UniqDSet"><span class="hs-identifier hs-type">UniqDSet</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span>          </span><span class="hs-comment">-- accum. package dependencies</span><span>
</span><span id="line-668"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- result</span><span>
</span><span id="line-669"></span><span>    </span><span id="local-6989586621681179690"><span class="annot"><span class="annottext">follow_deps :: [Module]
-&gt; UniqDSet ModuleName
-&gt; UniqDSet UnitId
-&gt; IO ([ModuleName], [UnitId])
</span><a href="#local-6989586621681179690"><span class="hs-identifier hs-var hs-var">follow_deps</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span id="local-6989586621681179670"><span class="annot"><span class="annottext">UniqDSet ModuleName
</span><a href="#local-6989586621681179670"><span class="hs-identifier hs-var">acc_mods</span></a></span></span><span> </span><span id="local-6989586621681179669"><span class="annot"><span class="annottext">UniqDSet UnitId
</span><a href="#local-6989586621681179669"><span class="hs-identifier hs-var">acc_pkgs</span></a></span></span><span>
</span><span id="line-670"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([ModuleName], [UnitId]) -&gt; IO ([ModuleName], [UnitId])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqDSet ModuleName -&gt; [ModuleName]
forall a. UniqDSet a -&gt; [a]
</span><a href="GHC.Types.Unique.DSet.html#uniqDSetToList"><span class="hs-identifier hs-var">uniqDSetToList</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet ModuleName
</span><a href="#local-6989586621681179670"><span class="hs-identifier hs-var">acc_mods</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">UniqDSet UnitId -&gt; [UnitId]
forall a. UniqDSet a -&gt; [a]
</span><a href="GHC.Types.Unique.DSet.html#uniqDSetToList"><span class="hs-identifier hs-var">uniqDSetToList</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet UnitId
</span><a href="#local-6989586621681179669"><span class="hs-identifier hs-var">acc_pkgs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-671"></span><span>    </span><span class="annot"><a href="#local-6989586621681179690"><span class="hs-identifier hs-var">follow_deps</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179668"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179668"><span class="hs-identifier hs-var">mod</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179667"><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681179667"><span class="hs-identifier hs-var">mods</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681179666"><span class="annot"><span class="annottext">UniqDSet ModuleName
</span><a href="#local-6989586621681179666"><span class="hs-identifier hs-var">acc_mods</span></a></span></span><span> </span><span id="local-6989586621681179665"><span class="annot"><span class="annottext">UniqDSet UnitId
</span><a href="#local-6989586621681179665"><span class="hs-identifier hs-var">acc_pkgs</span></a></span></span><span>
</span><span id="line-672"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-673"></span><span>          </span><span id="local-6989586621681179664"><span class="annot"><span class="annottext">MaybeErr SDoc ModIface
</span><a href="#local-6989586621681179664"><span class="hs-identifier hs-var">mb_iface</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SDoc
-&gt; HscEnv
-&gt; IfG (MaybeErr SDoc ModIface)
-&gt; IO (MaybeErr SDoc ModIface)
forall a. SDoc -&gt; HscEnv -&gt; IfG a -&gt; IO a
</span><a href="GHC.Tc.Utils.Monad.html#initIfaceCheck"><span class="hs-identifier hs-var">initIfaceCheck</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getLinkDeps&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179698"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">(IfG (MaybeErr SDoc ModIface) -&gt; IO (MaybeErr SDoc ModIface))
-&gt; IfG (MaybeErr SDoc ModIface) -&gt; IO (MaybeErr SDoc ModIface)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-674"></span><span>                        </span><span class="annot"><span class="annottext">SDoc -&gt; Module -&gt; WhereFrom -&gt; IfG (MaybeErr SDoc ModIface)
forall lcl.
SDoc -&gt; Module -&gt; WhereFrom -&gt; IfM lcl (MaybeErr SDoc ModIface)
</span><a href="GHC.Iface.Load.html#loadInterface"><span class="hs-identifier hs-var">loadInterface</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179661"><span class="hs-identifier hs-var">msg</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179668"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IsBootInterface -&gt; WhereFrom
</span><a href="GHC.Tc.Types.html#ImportByUser"><span class="hs-identifier hs-var">ImportByUser</span></a></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#NotBoot"><span class="hs-identifier hs-var">NotBoot</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-675"></span><span>          </span><span id="local-6989586621681179658"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681179658"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">MaybeErr SDoc ModIface
</span><a href="#local-6989586621681179664"><span class="hs-identifier hs-var">mb_iface</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-676"></span><span>                    </span><span class="annot"><a href="GHC.Data.Maybe.html#Failed"><span class="hs-identifier hs-type">Maybes.Failed</span></a></span><span> </span><span id="local-6989586621681179656"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179656"><span class="hs-identifier hs-var">err</span></a></span></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO ModIface
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179675"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179656"><span class="hs-identifier hs-var">err</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-677"></span><span>                    </span><span class="annot"><a href="GHC.Data.Maybe.html#Succeeded"><span class="hs-identifier hs-type">Maybes.Succeeded</span></a></span><span> </span><span id="local-6989586621681179654"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681179654"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; IO ModIface
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681179654"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-678"></span><span>
</span><span id="line-679"></span><span>          </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; IsBootInterface
</span><a href="GHC.Driver.Types.html#mi_boot"><span class="hs-identifier hs-var">mi_boot</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681179658"><span class="hs-identifier hs-var">iface</span></a></span><span> </span><span class="annot"><span class="annottext">IsBootInterface -&gt; IsBootInterface -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#IsBoot"><span class="hs-identifier hs-var">IsBoot</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; IO ()
forall {a} {a}. Outputable a =&gt; a -&gt; IO a
</span><a href="#local-6989586621681179650"><span class="hs-identifier hs-var">link_boot_mod_error</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179668"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-680"></span><span>
</span><span id="line-681"></span><span>          </span><span class="hs-keyword">let</span><span>
</span><span id="line-682"></span><span>            </span><span id="local-6989586621681179649"><span class="annot"><span class="annottext">pkg :: Unit
</span><a href="#local-6989586621681179649"><span class="hs-identifier hs-var hs-var">pkg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; Unit
forall unit. GenModule unit -&gt; unit
</span><a href="GHC.Unit.Types.html#moduleUnit"><span class="hs-identifier hs-var hs-var">moduleUnit</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179668"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-683"></span><span>            </span><span id="local-6989586621681179647"><span class="annot"><span class="annottext">deps :: Dependencies
</span><a href="#local-6989586621681179647"><span class="hs-identifier hs-var hs-var">deps</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; Dependencies
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Dependencies
</span><a href="GHC.Driver.Types.html#mi_deps"><span class="hs-identifier hs-var hs-var">mi_deps</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681179658"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-684"></span><span>
</span><span id="line-685"></span><span>            </span><span id="local-6989586621681179645"><span class="annot"><span class="annottext">pkg_deps :: [(UnitId, Bool)]
</span><a href="#local-6989586621681179645"><span class="hs-identifier hs-var hs-var">pkg_deps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Dependencies -&gt; [(UnitId, Bool)]
</span><a href="GHC.Driver.Types.html#dep_pkgs"><span class="hs-identifier hs-var hs-var">dep_pkgs</span></a></span><span> </span><span class="annot"><span class="annottext">Dependencies
</span><a href="#local-6989586621681179647"><span class="hs-identifier hs-var">deps</span></a></span><span>
</span><span id="line-686"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621681179643"><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681179643"><span class="hs-identifier hs-var">boot_deps</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179642"><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681179642"><span class="hs-identifier hs-var">mod_deps</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((ModuleNameWithIsBoot -&gt; Either ModuleName ModuleName)
 -&gt; [ModuleNameWithIsBoot] -&gt; ([ModuleName], [ModuleName]))
-&gt; [ModuleNameWithIsBoot]
-&gt; (ModuleNameWithIsBoot -&gt; Either ModuleName ModuleName)
-&gt; ([ModuleName], [ModuleName])
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">(ModuleNameWithIsBoot -&gt; Either ModuleName ModuleName)
-&gt; [ModuleNameWithIsBoot] -&gt; ([ModuleName], [ModuleName])
forall a b c. (a -&gt; Either b c) -&gt; [a] -&gt; ([b], [c])
</span><a href="GHC.Utils.Misc.html#partitionWith"><span class="hs-identifier hs-var">partitionWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Dependencies -&gt; [ModuleNameWithIsBoot]
</span><a href="GHC.Driver.Types.html#dep_mods"><span class="hs-identifier hs-var hs-var">dep_mods</span></a></span><span> </span><span class="annot"><span class="annottext">Dependencies
</span><a href="#local-6989586621681179647"><span class="hs-identifier hs-var">deps</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((ModuleNameWithIsBoot -&gt; Either ModuleName ModuleName)
 -&gt; ([ModuleName], [ModuleName]))
-&gt; (ModuleNameWithIsBoot -&gt; Either ModuleName ModuleName)
-&gt; ([ModuleName], [ModuleName])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-687"></span><span>              </span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#GWIB"><span class="hs-identifier hs-type">GWIB</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">gwib_mod :: forall mod. GenWithIsBoot mod -&gt; mod
</span><a href="GHC.Unit.Types.html#gwib_mod"><span class="hs-identifier hs-var">gwib_mod</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681179636"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681179636"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">gwib_isBoot :: forall mod. GenWithIsBoot mod -&gt; IsBootInterface
</span><a href="GHC.Unit.Types.html#gwib_isBoot"><span class="hs-identifier hs-var">gwib_isBoot</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681179634"><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621681179634"><span class="hs-identifier hs-var">is_boot</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-688"></span><span>                </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681179636"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
-&gt; (ModuleName -&gt; Either ModuleName ModuleName)
-&gt; Either ModuleName ModuleName
forall a b. a -&gt; (a -&gt; b) -&gt; b
</span><a href="../../base/src/Data.Function.html#%26"><span class="hs-operator hs-var">&amp;</span></a></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="#local-6989586621681179634"><span class="hs-identifier hs-var">is_boot</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-689"></span><span>                  </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#IsBoot"><span class="hs-identifier hs-var">IsBoot</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; Either ModuleName ModuleName
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span>
</span><span id="line-690"></span><span>                  </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#NotBoot"><span class="hs-identifier hs-var">NotBoot</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; Either ModuleName ModuleName
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span>
</span><span id="line-691"></span><span>
</span><span id="line-692"></span><span>            </span><span id="local-6989586621681179631"><span class="annot"><span class="annottext">boot_deps' :: [ModuleName]
</span><a href="#local-6989586621681179631"><span class="hs-identifier hs-var hs-var">boot_deps'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ModuleName -&gt; Bool) -&gt; [ModuleName] -&gt; [ModuleName]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (ModuleName -&gt; Bool) -&gt; ModuleName -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; UniqDSet ModuleName -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; UniqDSet a -&gt; Bool
</span><a href="GHC.Types.Unique.DSet.html#elementOfUniqDSet"><span class="hs-operator hs-var">`elementOfUniqDSet`</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet ModuleName
</span><a href="#local-6989586621681179666"><span class="hs-identifier hs-var">acc_mods</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681179643"><span class="hs-identifier hs-var">boot_deps</span></a></span><span>
</span><span id="line-693"></span><span>            </span><span id="local-6989586621681179628"><span class="annot"><span class="annottext">acc_mods' :: UniqDSet ModuleName
</span><a href="#local-6989586621681179628"><span class="hs-identifier hs-var hs-var">acc_mods'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqDSet ModuleName -&gt; [ModuleName] -&gt; UniqDSet ModuleName
forall a. Uniquable a =&gt; UniqDSet a -&gt; [a] -&gt; UniqDSet a
</span><a href="GHC.Types.Unique.DSet.html#addListToUniqDSet"><span class="hs-identifier hs-var">addListToUniqDSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet ModuleName
</span><a href="#local-6989586621681179666"><span class="hs-identifier hs-var">acc_mods</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179668"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; [ModuleName] -&gt; [ModuleName]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681179642"><span class="hs-identifier hs-var">mod_deps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-694"></span><span>            </span><span id="local-6989586621681179625"><span class="annot"><span class="annottext">acc_pkgs' :: UniqDSet UnitId
</span><a href="#local-6989586621681179625"><span class="hs-identifier hs-var hs-var">acc_pkgs'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqDSet UnitId -&gt; [UnitId] -&gt; UniqDSet UnitId
forall a. Uniquable a =&gt; UniqDSet a -&gt; [a] -&gt; UniqDSet a
</span><a href="GHC.Types.Unique.DSet.html#addListToUniqDSet"><span class="hs-identifier hs-var">addListToUniqDSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet UnitId
</span><a href="#local-6989586621681179665"><span class="hs-identifier hs-var">acc_pkgs</span></a></span><span> </span><span class="annot"><span class="annottext">([UnitId] -&gt; UniqDSet UnitId) -&gt; [UnitId] -&gt; UniqDSet UnitId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">((UnitId, Bool) -&gt; UnitId) -&gt; [(UnitId, Bool)] -&gt; [UnitId]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(UnitId, Bool) -&gt; UnitId
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(UnitId, Bool)]
</span><a href="#local-6989586621681179645"><span class="hs-identifier hs-var">pkg_deps</span></a></span><span>
</span><span id="line-695"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-696"></span><span>          </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621681179649"><span class="hs-identifier hs-var">pkg</span></a></span><span> </span><span class="annot"><span class="annottext">Unit -&gt; Unit -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621681179672"><span class="hs-identifier hs-var">this_pkg</span></a></span><span>
</span><span id="line-697"></span><span>             </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[Module]
-&gt; UniqDSet ModuleName
-&gt; UniqDSet UnitId
-&gt; IO ([ModuleName], [UnitId])
</span><a href="#local-6989586621681179690"><span class="hs-identifier hs-var">follow_deps</span></a></span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681179667"><span class="hs-identifier hs-var">mods</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet ModuleName
</span><a href="#local-6989586621681179666"><span class="hs-identifier hs-var">acc_mods</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqDSet UnitId -&gt; UnitId -&gt; UniqDSet UnitId
forall a. Uniquable a =&gt; UniqDSet a -&gt; a -&gt; UniqDSet a
</span><a href="GHC.Types.Unique.DSet.html#addOneToUniqDSet"><span class="hs-identifier hs-var">addOneToUniqDSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet UnitId
</span><a href="#local-6989586621681179625"><span class="hs-identifier hs-var">acc_pkgs'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unit -&gt; UnitId
</span><a href="GHC.Unit.Types.html#toUnitId"><span class="hs-identifier hs-var">toUnitId</span></a></span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621681179649"><span class="hs-identifier hs-var">pkg</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-698"></span><span>             </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[Module]
-&gt; UniqDSet ModuleName
-&gt; UniqDSet UnitId
-&gt; IO ([ModuleName], [UnitId])
</span><a href="#local-6989586621681179690"><span class="hs-identifier hs-var">follow_deps</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ModuleName -&gt; Module) -&gt; [ModuleName] -&gt; [Module]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unit -&gt; ModuleName -&gt; Module
forall u. u -&gt; ModuleName -&gt; GenModule u
</span><a href="GHC.Unit.Types.html#mkModule"><span class="hs-identifier hs-var">mkModule</span></a></span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621681179672"><span class="hs-identifier hs-var">this_pkg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681179631"><span class="hs-identifier hs-var">boot_deps'</span></a></span><span> </span><span class="annot"><span class="annottext">[Module] -&gt; [Module] -&gt; [Module]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681179667"><span class="hs-identifier hs-var">mods</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-699"></span><span>                              </span><span class="annot"><span class="annottext">UniqDSet ModuleName
</span><a href="#local-6989586621681179628"><span class="hs-identifier hs-var">acc_mods'</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet UnitId
</span><a href="#local-6989586621681179625"><span class="hs-identifier hs-var">acc_pkgs'</span></a></span><span>
</span><span id="line-700"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-701"></span><span>            </span><span id="local-6989586621681179661"><span class="annot"><span class="annottext">msg :: SDoc
</span><a href="#local-6989586621681179661"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;need to link module&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179668"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-702"></span><span>                  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;due to use of Template Haskell&quot;</span></span><span>
</span><span id="line-703"></span><span>
</span><span id="line-704"></span><span>
</span><span id="line-705"></span><span>    </span><span id="local-6989586621681179650"><span class="annot"><span class="annottext">link_boot_mod_error :: a -&gt; IO a
</span><a href="#local-6989586621681179650"><span class="hs-identifier hs-var hs-var">link_boot_mod_error</span></a></span></span><span> </span><span id="local-6989586621681179618"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681179618"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-706"></span><span>        </span><span class="annot"><span class="annottext">GhcException -&gt; IO a
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179675"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-707"></span><span>            </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;module&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681179618"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-708"></span><span>            </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;cannot be linked; it is only available as a boot module&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-709"></span><span>
</span><span id="line-710"></span><span>    </span><span id="local-6989586621681179616"><span id="local-6989586621681179617"><span class="annot"><a href="#local-6989586621681179615"><span class="hs-identifier hs-type">no_obj</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681179617"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681179617"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621681179616"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-711"></span><span>    </span><span id="local-6989586621681179615"><span class="annot"><span class="annottext">no_obj :: forall {a} {a}. Outputable a =&gt; a -&gt; IO a
</span><a href="#local-6989586621681179615"><span class="hs-identifier hs-var hs-var">no_obj</span></a></span></span><span> </span><span id="local-6989586621681179612"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681179612"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; SDoc -&gt; IO b
forall a. DynFlags -&gt; SrcSpan -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Linker.html#dieWith"><span class="hs-identifier hs-var">dieWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179675"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179694"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO b) -&gt; SDoc -&gt; IO b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-712"></span><span>                     </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;cannot find object file for module &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span>
</span><span id="line-713"></span><span>                        </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681179612"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-714"></span><span>                     </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179610"><span class="hs-identifier hs-var">while_linking_expr</span></a></span><span>
</span><span id="line-715"></span><span>
</span><span id="line-716"></span><span>    </span><span id="local-6989586621681179610"><span class="annot"><span class="annottext">while_linking_expr :: SDoc
</span><a href="#local-6989586621681179610"><span class="hs-identifier hs-var hs-var">while_linking_expr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;while linking an interpreted expression&quot;</span></span><span>
</span><span id="line-717"></span><span>
</span><span id="line-718"></span><span>        </span><span class="hs-comment">-- This one is a build-system bug</span><span>
</span><span id="line-719"></span><span>
</span><span id="line-720"></span><span>    </span><span id="local-6989586621681179673"><span class="annot"><span class="annottext">get_linkable :: String -&gt; ModuleName -&gt; IO Linkable
</span><a href="#local-6989586621681179673"><span class="hs-identifier hs-var hs-var">get_linkable</span></a></span></span><span> </span><span id="local-6989586621681179604"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179604"><span class="hs-identifier hs-var">osuf</span></a></span></span><span> </span><span id="local-6989586621681179603"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681179603"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span>      </span><span class="hs-comment">-- A home-package module</span><span>
</span><span id="line-721"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179602"><span class="annot"><span class="annottext">HomeModInfo
</span><a href="#local-6989586621681179602"><span class="hs-identifier hs-var">mod_info</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HomePackageTable -&gt; ModuleName -&gt; Maybe HomeModInfo
</span><a href="GHC.Driver.Types.html#lookupHpt"><span class="hs-identifier hs-var">lookupHpt</span></a></span><span> </span><span class="annot"><span class="annottext">HomePackageTable
</span><a href="#local-6989586621681179697"><span class="hs-identifier hs-var">hpt</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681179603"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-722"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; IO Linkable
</span><a href="#local-6989586621681179600"><span class="hs-identifier hs-var">adjust_linkable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Maybe Linkable -&gt; Linkable
forall a. HasCallStack =&gt; String -&gt; Maybe a -&gt; a
</span><a href="GHC.Data.Maybe.html#expectJust"><span class="hs-identifier hs-var">Maybes.expectJust</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getLinkDeps&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HomeModInfo -&gt; Maybe Linkable
</span><a href="GHC.Driver.Types.html#hm_linkable"><span class="hs-identifier hs-var hs-var">hm_linkable</span></a></span><span> </span><span class="annot"><span class="annottext">HomeModInfo
</span><a href="#local-6989586621681179602"><span class="hs-identifier hs-var">mod_info</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-723"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-724"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>    </span><span class="hs-comment">-- It's not in the HPT because we are in one shot mode,</span><span>
</span><span id="line-725"></span><span>                </span><span class="hs-comment">-- so use the Finder to get a ModLocation...</span><span>
</span><span id="line-726"></span><span>             </span><span id="local-6989586621681179597"><span class="annot"><span class="annottext">FindResult
</span><a href="#local-6989586621681179597"><span class="hs-identifier hs-var">mb_stuff</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; ModuleName -&gt; IO FindResult
</span><a href="GHC.Driver.Finder.html#findHomeModule"><span class="hs-identifier hs-var">findHomeModule</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179698"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681179603"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-727"></span><span>             </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">FindResult
</span><a href="#local-6989586621681179597"><span class="hs-identifier hs-var">mb_stuff</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-728"></span><span>                  </span><span class="annot"><a href="GHC.Driver.Types.html#Found"><span class="hs-identifier hs-type">Found</span></a></span><span> </span><span id="local-6989586621681179594"><span class="annot"><span class="annottext">ModLocation
</span><a href="#local-6989586621681179594"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681179593"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179593"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModLocation -&gt; Module -&gt; IO Linkable
</span><a href="#local-6989586621681179592"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">ModLocation
</span><a href="#local-6989586621681179594"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179593"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-729"></span><span>                  </span><span class="annot"><span class="annottext">FindResult
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; IO Linkable
forall {a} {a}. Outputable a =&gt; a -&gt; IO a
</span><a href="#local-6989586621681179615"><span class="hs-identifier hs-var">no_obj</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681179603"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-730"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-731"></span><span>            </span><span id="local-6989586621681179592"><span class="annot"><span class="annottext">found :: ModLocation -&gt; Module -&gt; IO Linkable
</span><a href="#local-6989586621681179592"><span class="hs-identifier hs-var hs-var">found</span></a></span></span><span> </span><span id="local-6989586621681179589"><span class="annot"><span class="annottext">ModLocation
</span><a href="#local-6989586621681179589"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681179588"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179588"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-732"></span><span>                </span><span class="hs-comment">-- ...and then find the linkable for it</span><span>
</span><span id="line-733"></span><span>               </span><span id="local-6989586621681179587"><span class="annot"><span class="annottext">Maybe Linkable
</span><a href="#local-6989586621681179587"><span class="hs-identifier hs-var">mb_lnk</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Module -&gt; ModLocation -&gt; IO (Maybe Linkable)
</span><a href="GHC.Driver.Finder.html#findObjectLinkableMaybe"><span class="hs-identifier hs-var">findObjectLinkableMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179588"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">ModLocation
</span><a href="#local-6989586621681179589"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">;</span><span>
</span><span id="line-734"></span><span>               </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe Linkable
</span><a href="#local-6989586621681179587"><span class="hs-identifier hs-var">mb_lnk</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-735"></span><span>                  </span><span class="annot"><span class="annottext">Maybe Linkable
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Module -&gt; IO Linkable
forall {a} {a}. Outputable a =&gt; a -&gt; IO a
</span><a href="#local-6989586621681179615"><span class="hs-identifier hs-var">no_obj</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179588"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="hs-special">;</span><span>
</span><span id="line-736"></span><span>                  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179585"><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179585"><span class="hs-identifier hs-var">lnk</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; IO Linkable
</span><a href="#local-6989586621681179600"><span class="hs-identifier hs-var">adjust_linkable</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179585"><span class="hs-identifier hs-var">lnk</span></a></span><span>
</span><span id="line-737"></span><span>              </span><span class="hs-special">}</span><span class="hs-special">}</span><span>
</span><span id="line-738"></span><span>
</span><span id="line-739"></span><span>            </span><span id="local-6989586621681179600"><span class="annot"><span class="annottext">adjust_linkable :: Linkable -&gt; IO Linkable
</span><a href="#local-6989586621681179600"><span class="hs-identifier hs-var hs-var">adjust_linkable</span></a></span></span><span> </span><span id="local-6989586621681179579"><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179579"><span class="hs-identifier hs-var">lnk</span></a></span></span><span>
</span><span id="line-740"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179578"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179578"><span class="hs-identifier hs-var">new_osuf</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179695"><span class="hs-identifier hs-var">replace_osuf</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-741"></span><span>                        </span><span id="local-6989586621681179577"><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179577"><span class="hs-identifier hs-var">new_uls</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Unlinked -&gt; IO Unlinked) -&gt; [Unlinked] -&gt; IO [Unlinked]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Unlinked -&gt; IO Unlinked
</span><a href="#local-6989586621681179576"><span class="hs-identifier hs-var">adjust_ul</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179578"><span class="hs-identifier hs-var">new_osuf</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-742"></span><span>                                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Linkable -&gt; [Unlinked]
</span><a href="GHC.Runtime.Linker.Types.html#linkableUnlinked"><span class="hs-identifier hs-var hs-var">linkableUnlinked</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179579"><span class="hs-identifier hs-var">lnk</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-743"></span><span>                        </span><span class="annot"><span class="annottext">Linkable -&gt; IO Linkable
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179579"><span class="hs-identifier hs-var">lnk</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">linkableUnlinked :: [Unlinked]
</span><a href="GHC.Runtime.Linker.Types.html#linkableUnlinked"><span class="hs-identifier hs-var">linkableUnlinked</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179577"><span class="hs-identifier hs-var">new_uls</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-744"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-745"></span><span>                        </span><span class="annot"><span class="annottext">Linkable -&gt; IO Linkable
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179579"><span class="hs-identifier hs-var">lnk</span></a></span><span>
</span><span id="line-746"></span><span>
</span><span id="line-747"></span><span>            </span><span id="local-6989586621681179576"><span class="annot"><span class="annottext">adjust_ul :: String -&gt; Unlinked -&gt; IO Unlinked
</span><a href="#local-6989586621681179576"><span class="hs-identifier hs-var hs-var">adjust_ul</span></a></span></span><span> </span><span id="local-6989586621681179563"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179563"><span class="hs-identifier hs-var">new_osuf</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DotO"><span class="hs-identifier hs-type">DotO</span></a></span><span> </span><span id="local-6989586621681179561"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179561"><span class="hs-identifier hs-var">file</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-748"></span><span>                </span><span class="hs-identifier">MASSERT</span><span class="hs-special">(</span><span class="hs-identifier">osuf</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">isSuffixOf</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">file</span><span class="hs-special">)</span><span>
</span><span id="line-749"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179557"><span class="annot"><span class="annottext">file_base :: String
</span><a href="#local-6989586621681179557"><span class="hs-identifier hs-var hs-var">file_base</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; String
forall a. HasCallStack =&gt; Maybe a -&gt; a
</span><a href="../../base/src/Data.Maybe.html#fromJust"><span class="hs-identifier hs-var">fromJust</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String -&gt; Maybe String
</span><a href="../../filepath/src/System.FilePath.Windows.html#stripExtension"><span class="hs-identifier hs-var">stripExtension</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179604"><span class="hs-identifier hs-var">osuf</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179561"><span class="hs-identifier hs-var">file</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-750"></span><span>                    </span><span id="local-6989586621681179554"><span class="annot"><span class="annottext">new_file :: String
</span><a href="#local-6989586621681179554"><span class="hs-identifier hs-var hs-var">new_file</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179557"><span class="hs-identifier hs-var">file_base</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179563"><span class="hs-identifier hs-var">new_osuf</span></a></span><span>
</span><span id="line-751"></span><span>                </span><span id="local-6989586621681179553"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179553"><span class="hs-identifier hs-var">ok</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO Bool
</span><a href="../../directory/src/System.Directory.html#doesFileExist"><span class="hs-identifier hs-var">doesFileExist</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179554"><span class="hs-identifier hs-var">new_file</span></a></span><span>
</span><span id="line-752"></span><span>                </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179553"><span class="hs-identifier hs-var">ok</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-753"></span><span>                   </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; SDoc -&gt; IO Unlinked
forall a. DynFlags -&gt; SrcSpan -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Linker.html#dieWith"><span class="hs-identifier hs-var">dieWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179675"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179694"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO Unlinked) -&gt; SDoc -&gt; IO Unlinked
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-754"></span><span>                          </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;cannot find object file &quot;</span></span><span>
</span><span id="line-755"></span><span>                                </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179554"><span class="hs-identifier hs-var">new_file</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681179610"><span class="hs-identifier hs-var">while_linking_expr</span></a></span><span>
</span><span id="line-756"></span><span>                   </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Unlinked -&gt; IO Unlinked
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Unlinked
</span><a href="GHC.Runtime.Linker.Types.html#DotO"><span class="hs-identifier hs-var">DotO</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179554"><span class="hs-identifier hs-var">new_file</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-757"></span><span>            </span><span class="annot"><a href="#local-6989586621681179576"><span class="hs-identifier hs-var">adjust_ul</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DotA"><span class="hs-identifier hs-type">DotA</span></a></span><span> </span><span id="local-6989586621681179551"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179551"><span class="hs-identifier hs-var">fp</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO Unlinked
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;adjust_ul DotA &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179551"><span class="hs-identifier hs-var">fp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-758"></span><span>            </span><span class="annot"><a href="#local-6989586621681179576"><span class="hs-identifier hs-var">adjust_ul</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DotDLL"><span class="hs-identifier hs-type">DotDLL</span></a></span><span> </span><span id="local-6989586621681179548"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179548"><span class="hs-identifier hs-var">fp</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO Unlinked
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;adjust_ul DotDLL &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179548"><span class="hs-identifier hs-var">fp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-759"></span><span>            </span><span class="annot"><a href="#local-6989586621681179576"><span class="hs-identifier hs-var">adjust_ul</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681179547"><span class="annot"><span class="annottext">l :: Unlinked
</span><a href="#local-6989586621681179547"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#BCOs"><span class="hs-identifier hs-type">BCOs</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unlinked -&gt; IO Unlinked
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Unlinked
</span><a href="#local-6989586621681179547"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-760"></span><span>
</span><span id="line-761"></span><span>
</span><span id="line-762"></span><span>
</span><span id="line-763"></span><span class="hs-comment">{- **********************************************************************

              Loading a Decls statement

  ********************************************************************* -}</span><span>
</span><span id="line-768"></span><span>
</span><span id="line-769"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkDecls"><span class="hs-identifier hs-type">linkDecls</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.ByteCode.Types.html#CompiledByteCode"><span class="hs-identifier hs-type">CompiledByteCode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-770"></span><span id="linkDecls"><span class="annot"><span class="annottext">linkDecls :: HscEnv -&gt; SrcSpan -&gt; CompiledByteCode -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#linkDecls"><span class="hs-identifier hs-var hs-var">linkDecls</span></a></span></span><span> </span><span id="local-6989586621681179545"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179545"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179544"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179544"><span class="hs-identifier hs-var">span</span></a></span></span><span> </span><span id="local-6989586621681179543"><span class="annot"><span class="annottext">cbc :: CompiledByteCode
</span><a href="#local-6989586621681179543"><span class="hs-identifier hs-var">cbc</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.ByteCode.Types.html#CompiledByteCode"><span class="hs-identifier hs-type">CompiledByteCode</span></a></span><span class="hs-special">{</span><span id="local-6989586621681179537"><span id="local-6989586621681179538"><span id="local-6989586621681179539"><span id="local-6989586621681179540"><span id="local-6989586621681179541"><span class="annot"><span class="annottext">[RemotePtr ()]
[FFIInfo]
[UnlinkedBCO]
Maybe ModBreaks
ItblEnv
bc_strs :: CompiledByteCode -&gt; [RemotePtr ()]
bc_itbls :: CompiledByteCode -&gt; ItblEnv
bc_ffis :: CompiledByteCode -&gt; [FFIInfo]
bc_breaks :: CompiledByteCode -&gt; Maybe ModBreaks
bc_bcos :: CompiledByteCode -&gt; [UnlinkedBCO]
bc_breaks :: Maybe ModBreaks
bc_strs :: [RemotePtr ()]
bc_ffis :: [FFIInfo]
bc_itbls :: ItblEnv
bc_bcos :: [UnlinkedBCO]
</span><a href="GHC.ByteCode.Types.html#bc_strs"><span class="hs-glyph hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">..</span></a></span></span></span></span></span></span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-771"></span><span>    </span><span class="hs-comment">-- Initialise the linker (if it's not been done already)</span><span>
</span><span id="line-772"></span><span>    </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#initDynLinker"><span class="hs-identifier hs-var">initDynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179545"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-773"></span><span>
</span><span id="line-774"></span><span>    </span><span class="hs-comment">-- Extract the DynLinker for passing into required places</span><span>
</span><span id="line-775"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179531"><span class="annot"><span class="annottext">dl :: DynLinker
</span><a href="#local-6989586621681179531"><span class="hs-identifier hs-var hs-var">dl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynLinker
</span><a href="GHC.Driver.Types.html#hsc_dynLinker"><span class="hs-identifier hs-var hs-var">hsc_dynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179545"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-776"></span><span>
</span><span id="line-777"></span><span>    </span><span class="hs-comment">-- Take lock for the actual work.</span><span>
</span><span id="line-778"></span><span>    </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState -&gt; IO (PersistentLinkerState, ()))
-&gt; IO ()
forall a.
DynLinker
-&gt; (PersistentLinkerState -&gt; IO (PersistentLinkerState, a)) -&gt; IO a
</span><a href="GHC.Runtime.Linker.html#modifyPLS"><span class="hs-identifier hs-var">modifyPLS</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179531"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState -&gt; IO (PersistentLinkerState, ()))
 -&gt; IO ())
-&gt; (PersistentLinkerState -&gt; IO (PersistentLinkerState, ()))
-&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681179530"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179530"><span class="hs-identifier hs-var">pls0</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-779"></span><span>
</span><span id="line-780"></span><span>    </span><span class="hs-comment">-- Link the packages and modules required</span><span>
</span><span id="line-781"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681179529"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179529"><span class="hs-identifier hs-var">pls</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179528"><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179528"><span class="hs-identifier hs-var">ok</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; PersistentLinkerState
-&gt; SrcSpan
-&gt; [Module]
-&gt; IO (PersistentLinkerState, SuccessFlag)
</span><a href="GHC.Runtime.Linker.html#linkDependencies"><span class="hs-identifier hs-var">linkDependencies</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179545"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179530"><span class="hs-identifier hs-var">pls0</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681179544"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681179527"><span class="hs-identifier hs-var">needed_mods</span></a></span><span>
</span><span id="line-782"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">SuccessFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#failed"><span class="hs-identifier hs-var">failed</span></a></span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179528"><span class="hs-identifier hs-var">ok</span></a></span><span>
</span><span id="line-783"></span><span>      </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO (PersistentLinkerState, ())
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-784"></span><span>      </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-785"></span><span>
</span><span id="line-786"></span><span>    </span><span class="hs-comment">-- Link the expression itself</span><span>
</span><span id="line-787"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179526"><span class="annot"><span class="annottext">ie :: ItblEnv
</span><a href="#local-6989586621681179526"><span class="hs-identifier hs-var hs-var">ie</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ItblEnv -&gt; ItblEnv -&gt; ItblEnv
forall a. NameEnv a -&gt; NameEnv a -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#plusNameEnv"><span class="hs-identifier hs-var">plusNameEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; ItblEnv
</span><a href="GHC.Runtime.Linker.Types.html#itbl_env"><span class="hs-identifier hs-var hs-var">itbl_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179529"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ItblEnv
</span><a href="#local-6989586621681179540"><span class="hs-identifier hs-var">bc_itbls</span></a></span><span>
</span><span id="line-788"></span><span>        </span><span id="local-6989586621681179524"><span class="annot"><span class="annottext">ce :: ClosureEnv
</span><a href="#local-6989586621681179524"><span class="hs-identifier hs-var hs-var">ce</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var hs-var">closure_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179529"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-789"></span><span>
</span><span id="line-790"></span><span>    </span><span class="hs-comment">-- Link the necessary packages and linkables</span><span>
</span><span id="line-791"></span><span>    </span><span id="local-6989586621681179523"><span class="annot"><span class="annottext">[(Name, HValueRef)]
</span><a href="#local-6989586621681179523"><span class="hs-identifier hs-var">new_bindings</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; ItblEnv
-&gt; ClosureEnv
-&gt; [CompiledByteCode]
-&gt; IO [(Name, HValueRef)]
</span><a href="GHC.Runtime.Linker.html#linkSomeBCOs"><span class="hs-identifier hs-var">linkSomeBCOs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179545"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ItblEnv
</span><a href="#local-6989586621681179526"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179524"><span class="hs-identifier hs-var">ce</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">CompiledByteCode
</span><a href="#local-6989586621681179543"><span class="hs-identifier hs-var">cbc</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-792"></span><span>    </span><span id="local-6989586621681179521"><span class="annot"><span class="annottext">[(Name, ForeignHValue)]
</span><a href="#local-6989586621681179521"><span class="hs-identifier hs-var">nms_fhvs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; [(Name, HValueRef)] -&gt; IO [(Name, ForeignHValue)]
</span><a href="GHC.Runtime.Linker.html#makeForeignNamedHValueRefs"><span class="hs-identifier hs-var">makeForeignNamedHValueRefs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179545"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, HValueRef)]
</span><a href="#local-6989586621681179523"><span class="hs-identifier hs-var">new_bindings</span></a></span><span>
</span><span id="line-793"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179519"><span class="annot"><span class="annottext">pls2 :: PersistentLinkerState
</span><a href="#local-6989586621681179519"><span class="hs-identifier hs-var hs-var">pls2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179529"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">closure_env :: ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var">closure_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureEnv -&gt; [(Name, ForeignHValue)] -&gt; ClosureEnv
</span><a href="GHC.ByteCode.Linker.html#extendClosureEnv"><span class="hs-identifier hs-var">extendClosureEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179524"><span class="hs-identifier hs-var">ce</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, ForeignHValue)]
</span><a href="#local-6989586621681179521"><span class="hs-identifier hs-var">nms_fhvs</span></a></span><span>
</span><span id="line-794"></span><span>                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">itbl_env :: ItblEnv
</span><a href="GHC.Runtime.Linker.Types.html#itbl_env"><span class="hs-identifier hs-var">itbl_env</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ItblEnv
</span><a href="#local-6989586621681179526"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-795"></span><span>    </span><span class="annot"><span class="annottext">(PersistentLinkerState, ()) -&gt; IO (PersistentLinkerState, ())
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179519"><span class="hs-identifier hs-var">pls2</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-796"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-797"></span><span>    </span><span id="local-6989586621681179517"><span class="annot"><span class="annottext">free_names :: [Name]
</span><a href="#local-6989586621681179517"><span class="hs-identifier hs-var hs-var">free_names</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqDSet Name -&gt; [Name]
forall a. UniqDSet a -&gt; [a]
</span><a href="GHC.Types.Unique.DSet.html#uniqDSetToList"><span class="hs-identifier hs-var">uniqDSetToList</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqDSet Name -&gt; [Name]) -&gt; UniqDSet Name -&gt; [Name]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-798"></span><span>      </span><span class="annot"><span class="annottext">(UnlinkedBCO -&gt; UniqDSet Name -&gt; UniqDSet Name)
-&gt; UniqDSet Name -&gt; [UnlinkedBCO] -&gt; UniqDSet Name
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqDSet Name -&gt; UniqDSet Name -&gt; UniqDSet Name
forall a. UniqDSet a -&gt; UniqDSet a -&gt; UniqDSet a
</span><a href="GHC.Types.Unique.DSet.html#unionUniqDSets"><span class="hs-identifier hs-var">unionUniqDSets</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqDSet Name -&gt; UniqDSet Name -&gt; UniqDSet Name)
-&gt; (UnlinkedBCO -&gt; UniqDSet Name)
-&gt; UnlinkedBCO
-&gt; UniqDSet Name
-&gt; UniqDSet Name
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">UnlinkedBCO -&gt; UniqDSet Name
</span><a href="GHC.ByteCode.Asm.html#bcoFreeNames"><span class="hs-identifier hs-var">bcoFreeNames</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UniqDSet Name
forall a. UniqDSet a
</span><a href="GHC.Types.Unique.DSet.html#emptyUniqDSet"><span class="hs-identifier hs-var">emptyUniqDSet</span></a></span><span> </span><span class="annot"><span class="annottext">[UnlinkedBCO]
</span><a href="#local-6989586621681179541"><span class="hs-identifier hs-var">bc_bcos</span></a></span><span>
</span><span id="line-799"></span><span>
</span><span id="line-800"></span><span>    </span><span class="annot"><a href="#local-6989586621681179527"><span class="hs-identifier hs-type">needed_mods</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-801"></span><span>    </span><span id="local-6989586621681179527"><span class="annot"><span class="annottext">needed_mods :: [Module]
</span><a href="#local-6989586621681179527"><span class="hs-identifier hs-var hs-var">needed_mods</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Module
Name -&gt; Module
</span><a href="GHC.Types.Name.html#nameModule"><span class="hs-identifier hs-var">nameModule</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179514"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681179514"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179514"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681179517"><span class="hs-identifier hs-var">free_names</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-802"></span><span>                    </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isExternalName"><span class="hs-identifier hs-var">isExternalName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179514"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- Names from other modules</span><span>
</span><span id="line-803"></span><span>                    </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isWiredInName"><span class="hs-identifier hs-var">isWiredInName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179514"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>   </span><span class="hs-comment">-- Exclude wired-in names</span><span>
</span><span id="line-804"></span><span>                  </span><span class="hs-special">]</span><span>                         </span><span class="hs-comment">-- (see note below)</span><span>
</span><span id="line-805"></span><span>    </span><span class="hs-comment">-- Exclude wired-in names because we may not have read</span><span>
</span><span id="line-806"></span><span>    </span><span class="hs-comment">-- their interface files, so getLinkDeps will fail</span><span>
</span><span id="line-807"></span><span>    </span><span class="hs-comment">-- All wired-in names are in the base package, which we link</span><span>
</span><span id="line-808"></span><span>    </span><span class="hs-comment">-- by default, so we can safely ignore them here.</span><span>
</span><span id="line-809"></span><span>
</span><span id="line-810"></span><span class="hs-comment">{- **********************************************************************

              Loading a single module

  ********************************************************************* -}</span><span>
</span><span id="line-815"></span><span>
</span><span id="line-816"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkModule"><span class="hs-identifier hs-type">linkModule</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-817"></span><span id="linkModule"><span class="annot"><span class="annottext">linkModule :: HscEnv -&gt; Module -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#linkModule"><span class="hs-identifier hs-var hs-var">linkModule</span></a></span></span><span> </span><span id="local-6989586621681179513"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179513"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179512"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179512"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-818"></span><span>  </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#initDynLinker"><span class="hs-identifier hs-var">initDynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179513"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-819"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179511"><span class="annot"><span class="annottext">dl :: DynLinker
</span><a href="#local-6989586621681179511"><span class="hs-identifier hs-var hs-var">dl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynLinker
</span><a href="GHC.Driver.Types.html#hsc_dynLinker"><span class="hs-identifier hs-var hs-var">hsc_dynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179513"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-820"></span><span>  </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#modifyPLS_"><span class="hs-identifier hs-var">modifyPLS_</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179511"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ())
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681179510"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179510"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-821"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681179509"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179509"><span class="hs-identifier hs-var">pls'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179508"><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179508"><span class="hs-identifier hs-var">ok</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; PersistentLinkerState
-&gt; SrcSpan
-&gt; [Module]
-&gt; IO (PersistentLinkerState, SuccessFlag)
</span><a href="GHC.Runtime.Linker.html#linkDependencies"><span class="hs-identifier hs-var">linkDependencies</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179513"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179510"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier hs-var">noSrcSpan</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179512"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-822"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SuccessFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#failed"><span class="hs-identifier hs-var">failed</span></a></span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179508"><span class="hs-identifier hs-var">ok</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO PersistentLinkerState
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;could not link module&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-823"></span><span>      </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179509"><span class="hs-identifier hs-var">pls'</span></a></span><span>
</span><span id="line-824"></span><span>
</span><span id="line-825"></span><span class="hs-comment">{- **********************************************************************

                Link some linkables
        The linkables may consist of a mixture of
        byte-code modules and object modules

  ********************************************************************* -}</span><span>
</span><span id="line-832"></span><span>
</span><span id="line-833"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkModules"><span class="hs-identifier hs-type">linkModules</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-834"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#SuccessFlag"><span class="hs-identifier hs-type">SuccessFlag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-835"></span><span id="linkModules"><span class="annot"><span class="annottext">linkModules :: HscEnv
-&gt; PersistentLinkerState
-&gt; [Linkable]
-&gt; IO (PersistentLinkerState, SuccessFlag)
</span><a href="GHC.Runtime.Linker.html#linkModules"><span class="hs-identifier hs-var hs-var">linkModules</span></a></span></span><span> </span><span id="local-6989586621681179507"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179507"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179506"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179506"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span id="local-6989586621681179505"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179505"><span class="hs-identifier hs-var">linkables</span></a></span></span><span>
</span><span id="line-836"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (PersistentLinkerState, SuccessFlag)
-&gt; IO (PersistentLinkerState, SuccessFlag)
forall a. IO a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#mask_"><span class="hs-identifier hs-var">mask_</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (PersistentLinkerState, SuccessFlag)
 -&gt; IO (PersistentLinkerState, SuccessFlag))
-&gt; IO (PersistentLinkerState, SuccessFlag)
-&gt; IO (PersistentLinkerState, SuccessFlag)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-comment">-- don't want to be interrupted by ^C in here</span><span>
</span><span id="line-837"></span><span>
</span><span id="line-838"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179502"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179502"><span class="hs-identifier hs-var">objs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179501"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179501"><span class="hs-identifier hs-var">bcos</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Linkable -&gt; Bool) -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; Bool
</span><a href="GHC.Driver.Types.html#isObjectLinkable"><span class="hs-identifier hs-var">isObjectLinkable</span></a></span><span>
</span><span id="line-839"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Linkable -&gt; [Linkable]) -&gt; [Linkable] -&gt; [Linkable]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; [Linkable]
</span><a href="GHC.Runtime.Linker.html#partitionLinkable"><span class="hs-identifier hs-var">partitionLinkable</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179505"><span class="hs-identifier hs-var">linkables</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-840"></span><span>
</span><span id="line-841"></span><span>                </span><span class="hs-comment">-- Load objects first; they can't depend on BCOs</span><span>
</span><span id="line-842"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681179497"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179497"><span class="hs-identifier hs-var">pls1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179496"><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179496"><span class="hs-identifier hs-var">ok_flag</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; PersistentLinkerState
-&gt; [Linkable]
-&gt; IO (PersistentLinkerState, SuccessFlag)
</span><a href="GHC.Runtime.Linker.html#dynLinkObjs"><span class="hs-identifier hs-var">dynLinkObjs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179507"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179506"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179502"><span class="hs-identifier hs-var">objs</span></a></span><span>
</span><span id="line-843"></span><span>
</span><span id="line-844"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">SuccessFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#failed"><span class="hs-identifier hs-var">failed</span></a></span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179496"><span class="hs-identifier hs-var">ok_flag</span></a></span><span> </span><span class="hs-keyword">then</span><span>
</span><span id="line-845"></span><span>                </span><span class="annot"><span class="annottext">(PersistentLinkerState, SuccessFlag)
-&gt; IO (PersistentLinkerState, SuccessFlag)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179497"><span class="hs-identifier hs-var">pls1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="GHC.Types.Basic.html#Failed"><span class="hs-identifier hs-var">Failed</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-846"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-847"></span><span>                </span><span id="local-6989586621681179493"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179493"><span class="hs-identifier hs-var">pls2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; PersistentLinkerState -&gt; [Linkable] -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#dynLinkBCOs"><span class="hs-identifier hs-var">dynLinkBCOs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179507"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179497"><span class="hs-identifier hs-var">pls1</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179501"><span class="hs-identifier hs-var">bcos</span></a></span><span>
</span><span id="line-848"></span><span>                </span><span class="annot"><span class="annottext">(PersistentLinkerState, SuccessFlag)
-&gt; IO (PersistentLinkerState, SuccessFlag)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179493"><span class="hs-identifier hs-var">pls2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="GHC.Types.Basic.html#Succeeded"><span class="hs-identifier hs-var">Succeeded</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-849"></span><span>
</span><span id="line-850"></span><span>
</span><span id="line-851"></span><span class="hs-comment">-- HACK to support f-x-dynamic in the interpreter; no other purpose</span><span>
</span><span id="line-852"></span><span class="annot"><a href="GHC.Runtime.Linker.html#partitionLinkable"><span class="hs-identifier hs-type">partitionLinkable</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-853"></span><span id="partitionLinkable"><span class="annot"><span class="annottext">partitionLinkable :: Linkable -&gt; [Linkable]
</span><a href="GHC.Runtime.Linker.html#partitionLinkable"><span class="hs-identifier hs-var hs-var">partitionLinkable</span></a></span></span><span> </span><span id="local-6989586621681179490"><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179490"><span class="hs-identifier hs-var">li</span></a></span></span><span>
</span><span id="line-854"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179489"><span class="annot"><span class="annottext">li_uls :: [Unlinked]
</span><a href="#local-6989586621681179489"><span class="hs-identifier hs-var hs-var">li_uls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; [Unlinked]
</span><a href="GHC.Runtime.Linker.Types.html#linkableUnlinked"><span class="hs-identifier hs-var hs-var">linkableUnlinked</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179490"><span class="hs-identifier hs-var">li</span></a></span><span>
</span><span id="line-855"></span><span>         </span><span id="local-6989586621681179488"><span class="annot"><span class="annottext">li_uls_obj :: [Unlinked]
</span><a href="#local-6989586621681179488"><span class="hs-identifier hs-var hs-var">li_uls_obj</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Unlinked -&gt; Bool) -&gt; [Unlinked] -&gt; [Unlinked]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">Unlinked -&gt; Bool
</span><a href="GHC.Driver.Types.html#isObject"><span class="hs-identifier hs-var">isObject</span></a></span><span> </span><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179489"><span class="hs-identifier hs-var">li_uls</span></a></span><span>
</span><span id="line-856"></span><span>         </span><span id="local-6989586621681179486"><span class="annot"><span class="annottext">li_uls_bco :: [Unlinked]
</span><a href="#local-6989586621681179486"><span class="hs-identifier hs-var hs-var">li_uls_bco</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Unlinked -&gt; Bool) -&gt; [Unlinked] -&gt; [Unlinked]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">Unlinked -&gt; Bool
</span><a href="GHC.Driver.Types.html#isInterpretable"><span class="hs-identifier hs-var">isInterpretable</span></a></span><span> </span><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179489"><span class="hs-identifier hs-var">li_uls</span></a></span><span>
</span><span id="line-857"></span><span>     </span><span class="hs-keyword">in</span><span>
</span><span id="line-858"></span><span>         </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179488"><span class="hs-identifier hs-var">li_uls_obj</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179486"><span class="hs-identifier hs-var">li_uls_bco</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-859"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unlinked
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[Unlinked]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unlinked
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[Unlinked]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179490"><span class="hs-identifier hs-var">li</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">linkableUnlinked :: [Unlinked]
</span><a href="GHC.Runtime.Linker.Types.html#linkableUnlinked"><span class="hs-identifier hs-var">linkableUnlinked</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179488"><span class="hs-identifier hs-var">li_uls_obj</span></a></span><span class="hs-special">}</span><span class="hs-special">,</span><span>
</span><span id="line-860"></span><span>                           </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179490"><span class="hs-identifier hs-var">li</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">linkableUnlinked :: [Unlinked]
</span><a href="GHC.Runtime.Linker.Types.html#linkableUnlinked"><span class="hs-identifier hs-var">linkableUnlinked</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179486"><span class="hs-identifier hs-var">li_uls_bco</span></a></span><span class="hs-special">}</span><span class="hs-special">]</span><span>
</span><span id="line-861"></span><span>            </span><span class="annot"><span class="annottext">([Unlinked], [Unlinked])
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179490"><span class="hs-identifier hs-var">li</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-862"></span><span>
</span><span id="line-863"></span><span class="annot"><a href="GHC.Runtime.Linker.html#findModuleLinkable_maybe"><span class="hs-identifier hs-type">findModuleLinkable_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span>
</span><span id="line-864"></span><span id="findModuleLinkable_maybe"><span class="annot"><span class="annottext">findModuleLinkable_maybe :: [Linkable] -&gt; Module -&gt; Maybe Linkable
</span><a href="GHC.Runtime.Linker.html#findModuleLinkable_maybe"><span class="hs-identifier hs-var hs-var">findModuleLinkable_maybe</span></a></span></span><span> </span><span id="local-6989586621681179483"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179483"><span class="hs-identifier hs-var">lis</span></a></span></span><span> </span><span id="local-6989586621681179482"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179482"><span class="hs-identifier hs-var">mod</span></a></span></span><span>
</span><span id="line-865"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">UTCTime -&gt; Module -&gt; [Unlinked] -&gt; Linkable
</span><a href="GHC.Runtime.Linker.Types.html#LM"><span class="hs-identifier hs-var">LM</span></a></span><span> </span><span class="annot"><span class="annottext">UTCTime
</span><a href="#local-6989586621681179480"><span class="hs-identifier hs-var">time</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179479"><span class="hs-identifier hs-var">nm</span></a></span><span> </span><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179478"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#LM"><span class="hs-identifier hs-type">LM</span></a></span><span> </span><span id="local-6989586621681179480"><span class="annot"><span class="annottext">UTCTime
</span><a href="#local-6989586621681179480"><span class="hs-identifier hs-var">time</span></a></span></span><span> </span><span id="local-6989586621681179479"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179479"><span class="hs-identifier hs-var">nm</span></a></span></span><span> </span><span id="local-6989586621681179478"><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179478"><span class="hs-identifier hs-var">us</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179483"><span class="hs-identifier hs-var">lis</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179479"><span class="hs-identifier hs-var">nm</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; Module -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179482"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-866"></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe Linkable
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-867"></span><span>        </span><span class="hs-special">[</span><span id="local-6989586621681179477"><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179477"><span class="hs-identifier hs-var">li</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; Maybe Linkable
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179477"><span class="hs-identifier hs-var">li</span></a></span><span>
</span><span id="line-868"></span><span>        </span><span class="annot"><span class="annottext">[Linkable]
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Maybe Linkable
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;findModuleLinkable&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681179482"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-869"></span><span>
</span><span id="line-870"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkableInSet"><span class="hs-identifier hs-type">linkableInSet</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-871"></span><span id="linkableInSet"><span class="annot"><span class="annottext">linkableInSet :: Linkable -&gt; [Linkable] -&gt; Bool
</span><a href="GHC.Runtime.Linker.html#linkableInSet"><span class="hs-identifier hs-var hs-var">linkableInSet</span></a></span></span><span> </span><span id="local-6989586621681179474"><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179474"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681179473"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179473"><span class="hs-identifier hs-var">objs_loaded</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-872"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; Module -&gt; Maybe Linkable
</span><a href="GHC.Runtime.Linker.html#findModuleLinkable_maybe"><span class="hs-identifier hs-var">findModuleLinkable_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179473"><span class="hs-identifier hs-var">objs_loaded</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Linkable -&gt; Module
</span><a href="GHC.Runtime.Linker.Types.html#linkableModule"><span class="hs-identifier hs-var hs-var">linkableModule</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179474"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-873"></span><span>        </span><span class="annot"><span class="annottext">Maybe Linkable
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-874"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179472"><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179472"><span class="hs-identifier hs-var">m</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; UTCTime
</span><a href="GHC.Runtime.Linker.Types.html#linkableTime"><span class="hs-identifier hs-var hs-var">linkableTime</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179474"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">UTCTime -&gt; UTCTime -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; UTCTime
</span><a href="GHC.Runtime.Linker.Types.html#linkableTime"><span class="hs-identifier hs-var hs-var">linkableTime</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179472"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-875"></span><span>
</span><span id="line-876"></span><span>
</span><span id="line-877"></span><span class="hs-comment">{- **********************************************************************

                The object-code linker

  ********************************************************************* -}</span><span>
</span><span id="line-882"></span><span>
</span><span id="line-883"></span><span class="annot"><a href="GHC.Runtime.Linker.html#dynLinkObjs"><span class="hs-identifier hs-type">dynLinkObjs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-884"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#SuccessFlag"><span class="hs-identifier hs-type">SuccessFlag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-885"></span><span id="dynLinkObjs"><span class="annot"><span class="annottext">dynLinkObjs :: HscEnv
-&gt; PersistentLinkerState
-&gt; [Linkable]
-&gt; IO (PersistentLinkerState, SuccessFlag)
</span><a href="GHC.Runtime.Linker.html#dynLinkObjs"><span class="hs-identifier hs-var hs-var">dynLinkObjs</span></a></span></span><span> </span><span id="local-6989586621681179470"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179470"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179469"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179469"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span id="local-6989586621681179468"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179468"><span class="hs-identifier hs-var">objs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-886"></span><span>        </span><span class="hs-comment">-- Load the object files and link them</span><span>
</span><span id="line-887"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179467"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179467"><span class="hs-identifier hs-var">objs_loaded'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179466"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179466"><span class="hs-identifier hs-var">new_objs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
</span><a href="GHC.Runtime.Linker.html#rmDupLinkables"><span class="hs-identifier hs-var">rmDupLinkables</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#objs_loaded"><span class="hs-identifier hs-var hs-var">objs_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179469"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179468"><span class="hs-identifier hs-var">objs</span></a></span><span>
</span><span id="line-888"></span><span>            </span><span id="local-6989586621681179464"><span class="annot"><span class="annottext">pls1 :: PersistentLinkerState
</span><a href="#local-6989586621681179464"><span class="hs-identifier hs-var hs-var">pls1</span></a></span></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179469"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">objs_loaded :: [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#objs_loaded"><span class="hs-identifier hs-var">objs_loaded</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179467"><span class="hs-identifier hs-var">objs_loaded'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-889"></span><span>            </span><span id="local-6989586621681179462"><span class="annot"><span class="annottext">unlinkeds :: [Unlinked]
</span><a href="#local-6989586621681179462"><span class="hs-identifier hs-var hs-var">unlinkeds</span></a></span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Linkable -&gt; [Unlinked]) -&gt; [Linkable] -&gt; [Unlinked]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; [Unlinked]
</span><a href="GHC.Runtime.Linker.Types.html#linkableUnlinked"><span class="hs-identifier hs-var hs-var">linkableUnlinked</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179466"><span class="hs-identifier hs-var">new_objs</span></a></span><span>
</span><span id="line-890"></span><span>            </span><span id="local-6989586621681179461"><span class="annot"><span class="annottext">wanted_objs :: [String]
</span><a href="#local-6989586621681179461"><span class="hs-identifier hs-var hs-var">wanted_objs</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Unlinked -&gt; String) -&gt; [Unlinked] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Unlinked -&gt; String
</span><a href="GHC.Driver.Types.html#nameOfObject"><span class="hs-identifier hs-var">nameOfObject</span></a></span><span> </span><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179462"><span class="hs-identifier hs-var">unlinkeds</span></a></span><span>
</span><span id="line-891"></span><span>
</span><span id="line-892"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Interp -&gt; Bool
</span><a href="GHC.Runtime.Interpreter.html#interpreterDynamic"><span class="hs-identifier hs-var">interpreterDynamic</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; Interp
</span><a href="GHC.Runtime.Interpreter.html#hscInterp"><span class="hs-identifier hs-var">hscInterp</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179470"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-893"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681179457"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179457"><span class="hs-identifier hs-var">pls2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; PersistentLinkerState -&gt; [String] -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#dynLoadObjs"><span class="hs-identifier hs-var">dynLoadObjs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179470"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179464"><span class="hs-identifier hs-var">pls1</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179461"><span class="hs-identifier hs-var">wanted_objs</span></a></span><span>
</span><span id="line-894"></span><span>                    </span><span class="annot"><span class="annottext">(PersistentLinkerState, SuccessFlag)
-&gt; IO (PersistentLinkerState, SuccessFlag)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179457"><span class="hs-identifier hs-var">pls2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="GHC.Types.Basic.html#Succeeded"><span class="hs-identifier hs-var">Succeeded</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-895"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO ()) -&gt; [String] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Interpreter.html#loadObj"><span class="hs-identifier hs-var">loadObj</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179470"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179461"><span class="hs-identifier hs-var">wanted_objs</span></a></span><span>
</span><span id="line-896"></span><span>
</span><span id="line-897"></span><span>                    </span><span class="hs-comment">-- Link them all together</span><span>
</span><span id="line-898"></span><span>                    </span><span id="local-6989586621681179456"><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179456"><span class="hs-identifier hs-var">ok</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; IO SuccessFlag
</span><a href="GHC.Runtime.Interpreter.html#resolveObjs"><span class="hs-identifier hs-var">resolveObjs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179470"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-899"></span><span>
</span><span id="line-900"></span><span>                    </span><span class="hs-comment">-- If resolving failed, unload all our</span><span>
</span><span id="line-901"></span><span>                    </span><span class="hs-comment">-- object modules and carry on</span><span>
</span><span id="line-902"></span><span>                    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">SuccessFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#succeeded"><span class="hs-identifier hs-var">succeeded</span></a></span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179456"><span class="hs-identifier hs-var">ok</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-903"></span><span>                            </span><span class="annot"><span class="annottext">(PersistentLinkerState, SuccessFlag)
-&gt; IO (PersistentLinkerState, SuccessFlag)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179464"><span class="hs-identifier hs-var">pls1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="GHC.Types.Basic.html#Succeeded"><span class="hs-identifier hs-var">Succeeded</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-904"></span><span>                      </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-905"></span><span>                            </span><span id="local-6989586621681179455"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179455"><span class="hs-identifier hs-var">pls2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; [Linkable] -&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#unload_wkr"><span class="hs-identifier hs-var">unload_wkr</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179470"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179464"><span class="hs-identifier hs-var">pls1</span></a></span><span>
</span><span id="line-906"></span><span>                            </span><span class="annot"><span class="annottext">(PersistentLinkerState, SuccessFlag)
-&gt; IO (PersistentLinkerState, SuccessFlag)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179455"><span class="hs-identifier hs-var">pls2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="GHC.Types.Basic.html#Failed"><span class="hs-identifier hs-var">Failed</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-907"></span><span>
</span><span id="line-908"></span><span>
</span><span id="line-909"></span><span class="annot"><a href="GHC.Runtime.Linker.html#dynLoadObjs"><span class="hs-identifier hs-type">dynLoadObjs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-910"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-911"></span><span id="dynLoadObjs"><span class="annot"><span class="annottext">dynLoadObjs :: HscEnv
-&gt; PersistentLinkerState -&gt; [String] -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#dynLoadObjs"><span class="hs-identifier hs-var hs-var">dynLoadObjs</span></a></span></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><span class="hs-identifier">_</span></span><span>       </span><span id="local-6989586621681179453"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179453"><span class="hs-identifier hs-var">pls</span></a></span></span><span>                           </span><span class="hs-special">[</span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179453"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-912"></span><span class="annot"><a href="GHC.Runtime.Linker.html#dynLoadObjs"><span class="hs-identifier hs-var">dynLoadObjs</span></a></span><span> </span><span id="local-6989586621681179452"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179452"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179451"><span class="annot"><span class="annottext">pls :: PersistentLinkerState
</span><a href="#local-6989586621681179451"><span class="hs-identifier hs-var">pls</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span class="hs-special">{</span><span id="local-6989586621681179445"><span id="local-6989586621681179446"><span id="local-6989586621681179447"><span id="local-6989586621681179448"><span id="local-6989586621681179449"><span id="local-6989586621681179450"><span class="annot"><span class="annottext">[(String, String)]
[UnitId]
[Linkable]
ClosureEnv
ItblEnv
temp_sos :: [(String, String)]
pkgs_loaded :: [UnitId]
objs_loaded :: [Linkable]
bcos_loaded :: [Linkable]
itbl_env :: ItblEnv
closure_env :: ClosureEnv
temp_sos :: PersistentLinkerState -&gt; [(String, String)]
objs_loaded :: PersistentLinkerState -&gt; [Linkable]
bcos_loaded :: PersistentLinkerState -&gt; [Linkable]
pkgs_loaded :: PersistentLinkerState -&gt; [UnitId]
itbl_env :: PersistentLinkerState -&gt; ItblEnv
closure_env :: PersistentLinkerState -&gt; ClosureEnv
</span><a href="#local-6989586621681179445"><span class="hs-glyph hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">..</span></a></span></span></span></span></span></span></span><span class="hs-special">}</span><span> </span><span id="local-6989586621681179444"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179444"><span class="hs-identifier hs-var">objs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-913"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179443"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681179443"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179452"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-914"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179442"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681179442"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179443"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-915"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179441"><span class="annot"><span class="annottext">minus_ls :: [String]
</span><a href="#local-6989586621681179441"><span class="hs-identifier hs-var hs-var">minus_ls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179440"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'l'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179440"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179440"><span class="hs-identifier hs-var">lib</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [Option]
</span><a href="GHC.Driver.Session.html#ldInputs"><span class="hs-identifier hs-var hs-var">ldInputs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179443"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-916"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179439"><span class="annot"><span class="annottext">minus_big_ls :: [String]
</span><a href="#local-6989586621681179439"><span class="hs-identifier hs-var hs-var">minus_big_ls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179438"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'L'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179438"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179438"><span class="hs-identifier hs-var">lib</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [Option]
</span><a href="GHC.Driver.Session.html#ldInputs"><span class="hs-identifier hs-var hs-var">ldInputs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179443"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-917"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681179437"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179437"><span class="hs-identifier hs-var">soFile</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179436"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179436"><span class="hs-identifier hs-var">libPath</span></a></span></span><span> </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179435"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179435"><span class="hs-identifier hs-var">libName</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-918"></span><span>      </span><span class="annot"><span class="annottext">DynFlags
-&gt; TempFileLifetime -&gt; String -&gt; IO (String, String, String)
</span><a href="GHC.SysTools.FileCleanup.html#newTempLibName"><span class="hs-identifier hs-var">newTempLibName</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179443"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">TempFileLifetime
</span><a href="GHC.SysTools.FileCleanup.html#TFL_CurrentModule"><span class="hs-identifier hs-var">TFL_CurrentModule</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; String
</span><a href="GHC.Driver.Types.html#soExt"><span class="hs-identifier hs-var">soExt</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179442"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-919"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-920"></span><span>        </span><span id="local-6989586621681179422"><span class="annot"><span class="annottext">dflags2 :: DynFlags
</span><a href="#local-6989586621681179422"><span class="hs-identifier hs-var hs-var">dflags2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179443"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-921"></span><span>                      </span><span class="hs-comment">-- We don't want the original ldInputs in</span><span>
</span><span id="line-922"></span><span>                      </span><span class="hs-comment">-- (they're already linked in), but we do want</span><span>
</span><span id="line-923"></span><span>                      </span><span class="hs-comment">-- to link against previous dynLoadObjs</span><span>
</span><span id="line-924"></span><span>                      </span><span class="hs-comment">-- libraries if there were any, so that the linker</span><span>
</span><span id="line-925"></span><span>                      </span><span class="hs-comment">-- can resolve dependencies when it loads this</span><span>
</span><span id="line-926"></span><span>                      </span><span class="hs-comment">-- library.</span><span>
</span><span id="line-927"></span><span>                      </span><span class="annot"><span class="annottext">ldInputs :: [Option]
</span><a href="GHC.Driver.Session.html#ldInputs"><span class="hs-identifier hs-var">ldInputs</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-928"></span><span>                           </span><span class="annot"><span class="annottext">(String -&gt; [Option]) -&gt; [String] -&gt; [Option]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681179421"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179421"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-l&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179421"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-929"></span><span>                                     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; [String]
forall a. Eq a =&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#nub"><span class="hs-identifier hs-var">nub</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String]) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; String
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">((String, String) -&gt; String) -&gt; [(String, String)] -&gt; [String]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, String)]
</span><a href="#local-6989586621681179445"><span class="hs-identifier hs-var">temp_sos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-930"></span><span>                        </span><span class="annot"><span class="annottext">[Option] -&gt; [Option] -&gt; [Option]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; [Option]) -&gt; [String] -&gt; [Option]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681179420"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179420"><span class="hs-identifier hs-var">lp</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-L&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179420"><span class="hs-identifier hs-var">lp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-931"></span><span>                                          </span><span class="annot"><span class="annottext">Option -&gt; [Option] -&gt; [Option]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; OS -&gt; Bool
</span><a href="GHC.Driver.Session.html#useXLinkerRPath"><span class="hs-identifier hs-var">useXLinkerRPath</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179443"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformOS"><span class="hs-identifier hs-var">platformOS</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179442"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-932"></span><span>                                            </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-Xlinker&quot;</span></span><span>
</span><span id="line-933"></span><span>                                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-rpath&quot;</span></span><span>
</span><span id="line-934"></span><span>                                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-Xlinker&quot;</span></span><span>
</span><span id="line-935"></span><span>                                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179420"><span class="hs-identifier hs-var">lp</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-936"></span><span>                                            </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-937"></span><span>                                     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; [String]
forall a. Eq a =&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#nub"><span class="hs-identifier hs-var">nub</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String]) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; String
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">((String, String) -&gt; String) -&gt; [(String, String)] -&gt; [String]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, String)]
</span><a href="#local-6989586621681179445"><span class="hs-identifier hs-var">temp_sos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-938"></span><span>                        </span><span class="annot"><span class="annottext">[Option] -&gt; [Option] -&gt; [Option]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; [Option]) -&gt; [String] -&gt; [Option]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span>
</span><span id="line-939"></span><span>                             </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681179418"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179418"><span class="hs-identifier hs-var">lp</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-L&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179418"><span class="hs-identifier hs-var">lp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-940"></span><span>                                  </span><span class="annot"><span class="annottext">Option -&gt; [Option] -&gt; [Option]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; OS -&gt; Bool
</span><a href="GHC.Driver.Session.html#useXLinkerRPath"><span class="hs-identifier hs-var">useXLinkerRPath</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179443"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformOS"><span class="hs-identifier hs-var">platformOS</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179442"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-941"></span><span>                                    </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-Xlinker&quot;</span></span><span>
</span><span id="line-942"></span><span>                                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-rpath&quot;</span></span><span>
</span><span id="line-943"></span><span>                                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-Xlinker&quot;</span></span><span>
</span><span id="line-944"></span><span>                                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179418"><span class="hs-identifier hs-var">lp</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-945"></span><span>                                    </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-946"></span><span>                             </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179439"><span class="hs-identifier hs-var">minus_big_ls</span></a></span><span>
</span><span id="line-947"></span><span>                        </span><span class="hs-comment">-- See Note [-Xlinker -rpath vs -Wl,-rpath]</span><span>
</span><span id="line-948"></span><span>                        </span><span class="annot"><span class="annottext">[Option] -&gt; [Option] -&gt; [Option]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Option) -&gt; [String] -&gt; [Option]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681179417"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179417"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-l&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179417"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179441"><span class="hs-identifier hs-var">minus_ls</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-949"></span><span>                      </span><span class="hs-comment">-- Add -l options and -L options from dflags.</span><span>
</span><span id="line-950"></span><span>                      </span><span class="hs-comment">--</span><span>
</span><span id="line-951"></span><span>                      </span><span class="hs-comment">-- When running TH for a non-dynamic way, we still</span><span>
</span><span id="line-952"></span><span>                      </span><span class="hs-comment">-- need to make -l flags to link against the dynamic</span><span>
</span><span id="line-953"></span><span>                      </span><span class="hs-comment">-- libraries, so we need to add WayDyn to ways.</span><span>
</span><span id="line-954"></span><span>                      </span><span class="hs-comment">--</span><span>
</span><span id="line-955"></span><span>                      </span><span class="hs-comment">-- Even if we're e.g. profiling, we still want</span><span>
</span><span id="line-956"></span><span>                      </span><span class="hs-comment">-- the vanilla dynamic libraries, so we set the</span><span>
</span><span id="line-957"></span><span>                      </span><span class="hs-comment">-- ways / build tag to be just WayDyn.</span><span>
</span><span id="line-958"></span><span>                      </span><span class="annot"><span class="annottext">ways :: Set Way
</span><a href="GHC.Driver.Session.html#ways"><span class="hs-identifier hs-var">ways</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Way -&gt; Set Way
forall a. a -&gt; Set a
</span><a href="../../containers/src/Data.Set.Internal.html#singleton"><span class="hs-identifier hs-var">Set.singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Way
</span><a href="GHC.Driver.Ways.html#WayDyn"><span class="hs-identifier hs-var">WayDyn</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-959"></span><span>                      </span><span class="annot"><span class="annottext">outputFile :: Maybe String
</span><a href="GHC.Driver.Session.html#outputFile"><span class="hs-identifier hs-var">outputFile</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe String
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179437"><span class="hs-identifier hs-var">soFile</span></a></span><span>
</span><span id="line-960"></span><span>                  </span><span class="hs-special">}</span><span>
</span><span id="line-961"></span><span>    </span><span class="hs-comment">-- link all &quot;loaded packages&quot; so symbols in those can be resolved</span><span>
</span><span id="line-962"></span><span>    </span><span class="hs-comment">-- Note: We are loading packages with local scope, so to see the</span><span>
</span><span id="line-963"></span><span>    </span><span class="hs-comment">-- symbols in this link we must link all loaded packages again.</span><span>
</span><span id="line-964"></span><span>    </span><span class="annot"><span class="annottext">DynFlags -&gt; [String] -&gt; [UnitId] -&gt; IO ()
</span><a href="GHC.SysTools.html#linkDynLib"><span class="hs-identifier hs-var">linkDynLib</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179422"><span class="hs-identifier hs-var">dflags2</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179444"><span class="hs-identifier hs-var">objs</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179446"><span class="hs-identifier hs-var">pkgs_loaded</span></a></span><span>
</span><span id="line-965"></span><span>
</span><span id="line-966"></span><span>    </span><span class="hs-comment">-- if we got this far, extend the lifetime of the library file</span><span>
</span><span id="line-967"></span><span>    </span><span class="annot"><span class="annottext">DynFlags -&gt; TempFileLifetime -&gt; [String] -&gt; IO ()
</span><a href="GHC.SysTools.FileCleanup.html#changeTempFilesLifetime"><span class="hs-identifier hs-var">changeTempFilesLifetime</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179443"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">TempFileLifetime
</span><a href="GHC.SysTools.FileCleanup.html#TFL_GhcSession"><span class="hs-identifier hs-var">TFL_GhcSession</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179437"><span class="hs-identifier hs-var">soFile</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-968"></span><span>    </span><span id="local-6989586621681179411"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179411"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Interpreter.html#loadDLL"><span class="hs-identifier hs-var">loadDLL</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179452"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179437"><span class="hs-identifier hs-var">soFile</span></a></span><span>
</span><span id="line-969"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179411"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-970"></span><span>        </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(PersistentLinkerState -&gt; IO PersistentLinkerState)
-&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179451"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">temp_sos :: [(String, String)]
</span><a href="GHC.Runtime.Linker.Types.html#temp_sos"><span class="hs-identifier hs-var">temp_sos</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179436"><span class="hs-identifier hs-var">libPath</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179435"><span class="hs-identifier hs-var">libName</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; [(String, String)] -&gt; [(String, String)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(String, String)]
</span><a href="#local-6989586621681179445"><span class="hs-identifier hs-var">temp_sos</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-971"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179410"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179410"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; IO PersistentLinkerState
forall a. String -&gt; String -&gt; IO a
</span><a href="GHC.ByteCode.Linker.html#linkFail"><span class="hs-identifier hs-var">linkFail</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179409"><span class="hs-identifier hs-var">msg</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179410"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-972"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-973"></span><span>    </span><span id="local-6989586621681179409"><span class="annot"><span class="annottext">msg :: String
</span><a href="#local-6989586621681179409"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC.Runtime.Linker.dynLoadObjs: Loading temp shared object failed&quot;</span></span><span>
</span><span id="line-974"></span><span>
</span><span id="line-975"></span><span class="annot"><a href="GHC.Runtime.Linker.html#rmDupLinkables"><span class="hs-identifier hs-type">rmDupLinkables</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span>    </span><span class="hs-comment">-- Already loaded</span><span>
</span><span id="line-976"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span>    </span><span class="hs-comment">-- New linkables</span><span>
</span><span id="line-977"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>  </span><span class="hs-comment">-- New loaded set (including new ones)</span><span>
</span><span id="line-978"></span><span>                   </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- New linkables (excluding dups)</span><span>
</span><span id="line-979"></span><span id="rmDupLinkables"><span class="annot"><span class="annottext">rmDupLinkables :: [Linkable] -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
</span><a href="GHC.Runtime.Linker.html#rmDupLinkables"><span class="hs-identifier hs-var hs-var">rmDupLinkables</span></a></span></span><span> </span><span id="local-6989586621681179408"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179408"><span class="hs-identifier hs-var">already</span></a></span></span><span> </span><span id="local-6989586621681179407"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179407"><span class="hs-identifier hs-var">ls</span></a></span></span><span>
</span><span id="line-980"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; [Linkable] -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
</span><a href="#local-6989586621681179406"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179408"><span class="hs-identifier hs-var">already</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179407"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-981"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-982"></span><span>    </span><span id="local-6989586621681179406"><span class="annot"><span class="annottext">go :: [Linkable] -&gt; [Linkable] -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
</span><a href="#local-6989586621681179406"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621681179405"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179405"><span class="hs-identifier hs-var">already</span></a></span></span><span> </span><span id="local-6989586621681179404"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179404"><span class="hs-identifier hs-var">extras</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179405"><span class="hs-identifier hs-var">already</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179404"><span class="hs-identifier hs-var">extras</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-983"></span><span>    </span><span class="annot"><a href="#local-6989586621681179406"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621681179403"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179403"><span class="hs-identifier hs-var">already</span></a></span></span><span> </span><span id="local-6989586621681179402"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179402"><span class="hs-identifier hs-var">extras</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179401"><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179401"><span class="hs-identifier hs-var">l</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179400"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179400"><span class="hs-identifier hs-var">ls</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-984"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; [Linkable] -&gt; Bool
</span><a href="GHC.Runtime.Linker.html#linkableInSet"><span class="hs-identifier hs-var">linkableInSet</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179401"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179403"><span class="hs-identifier hs-var">already</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; [Linkable] -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
</span><a href="#local-6989586621681179406"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179403"><span class="hs-identifier hs-var">already</span></a></span><span>     </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179402"><span class="hs-identifier hs-var">extras</span></a></span><span>     </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179400"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-985"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; [Linkable] -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
</span><a href="#local-6989586621681179406"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179401"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Linkable -&gt; [Linkable] -&gt; [Linkable]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179403"><span class="hs-identifier hs-var">already</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179401"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Linkable -&gt; [Linkable] -&gt; [Linkable]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179402"><span class="hs-identifier hs-var">extras</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179400"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-986"></span><span>
</span><span id="line-987"></span><span class="hs-comment">{- **********************************************************************

                The byte-code linker

  ********************************************************************* -}</span><span>
</span><span id="line-992"></span><span>
</span><span id="line-993"></span><span>
</span><span id="line-994"></span><span class="annot"><a href="GHC.Runtime.Linker.html#dynLinkBCOs"><span class="hs-identifier hs-type">dynLinkBCOs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-995"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-996"></span><span id="dynLinkBCOs"><span class="annot"><span class="annottext">dynLinkBCOs :: HscEnv
-&gt; PersistentLinkerState -&gt; [Linkable] -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#dynLinkBCOs"><span class="hs-identifier hs-var hs-var">dynLinkBCOs</span></a></span></span><span> </span><span id="local-6989586621681179399"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179399"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179398"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179398"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span id="local-6989586621681179397"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179397"><span class="hs-identifier hs-var">bcos</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-997"></span><span>
</span><span id="line-998"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179396"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179396"><span class="hs-identifier hs-var">bcos_loaded'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179395"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179395"><span class="hs-identifier hs-var">new_bcos</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
</span><a href="GHC.Runtime.Linker.html#rmDupLinkables"><span class="hs-identifier hs-var">rmDupLinkables</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#bcos_loaded"><span class="hs-identifier hs-var hs-var">bcos_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179398"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179397"><span class="hs-identifier hs-var">bcos</span></a></span><span>
</span><span id="line-999"></span><span>            </span><span id="local-6989586621681179394"><span class="annot"><span class="annottext">pls1 :: PersistentLinkerState
</span><a href="#local-6989586621681179394"><span class="hs-identifier hs-var hs-var">pls1</span></a></span></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179398"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bcos_loaded :: [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#bcos_loaded"><span class="hs-identifier hs-var">bcos_loaded</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179396"><span class="hs-identifier hs-var">bcos_loaded'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1000"></span><span>            </span><span class="annot"><a href="#local-6989586621681179393"><span class="hs-identifier hs-type">unlinkeds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Unlinked"><span class="hs-identifier hs-type">Unlinked</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1001"></span><span>            </span><span id="local-6989586621681179393"><span class="annot"><span class="annottext">unlinkeds :: [Unlinked]
</span><a href="#local-6989586621681179393"><span class="hs-identifier hs-var hs-var">unlinkeds</span></a></span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Linkable -&gt; [Unlinked]) -&gt; [Linkable] -&gt; [Unlinked]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; [Unlinked]
</span><a href="GHC.Runtime.Linker.Types.html#linkableUnlinked"><span class="hs-identifier hs-var hs-var">linkableUnlinked</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179395"><span class="hs-identifier hs-var">new_bcos</span></a></span><span>
</span><span id="line-1002"></span><span>
</span><span id="line-1003"></span><span>            </span><span class="annot"><a href="#local-6989586621681179392"><span class="hs-identifier hs-type">cbcs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.ByteCode.Types.html#CompiledByteCode"><span class="hs-identifier hs-type">CompiledByteCode</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1004"></span><span>            </span><span id="local-6989586621681179392"><span class="annot"><span class="annottext">cbcs :: [CompiledByteCode]
</span><a href="#local-6989586621681179392"><span class="hs-identifier hs-var hs-var">cbcs</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Unlinked -&gt; CompiledByteCode) -&gt; [Unlinked] -&gt; [CompiledByteCode]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Unlinked -&gt; CompiledByteCode
</span><a href="GHC.Driver.Types.html#byteCodeOfObject"><span class="hs-identifier hs-var">byteCodeOfObject</span></a></span><span> </span><span class="annot"><span class="annottext">[Unlinked]
</span><a href="#local-6989586621681179393"><span class="hs-identifier hs-var">unlinkeds</span></a></span><span>
</span><span id="line-1005"></span><span>
</span><span id="line-1006"></span><span>
</span><span id="line-1007"></span><span>            </span><span id="local-6989586621681179390"><span class="annot"><span class="annottext">ies :: [ItblEnv]
</span><a href="#local-6989586621681179390"><span class="hs-identifier hs-var hs-var">ies</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CompiledByteCode -&gt; ItblEnv) -&gt; [CompiledByteCode] -&gt; [ItblEnv]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">CompiledByteCode -&gt; ItblEnv
</span><a href="GHC.ByteCode.Types.html#bc_itbls"><span class="hs-identifier hs-var hs-var">bc_itbls</span></a></span><span> </span><span class="annot"><span class="annottext">[CompiledByteCode]
</span><a href="#local-6989586621681179392"><span class="hs-identifier hs-var">cbcs</span></a></span><span>
</span><span id="line-1008"></span><span>            </span><span id="local-6989586621681179389"><span class="annot"><span class="annottext">gce :: ClosureEnv
</span><a href="#local-6989586621681179389"><span class="hs-identifier hs-var hs-var">gce</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var hs-var">closure_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179398"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-1009"></span><span>            </span><span id="local-6989586621681179387"><span class="annot"><span class="annottext">final_ie :: ItblEnv
</span><a href="#local-6989586621681179387"><span class="hs-identifier hs-var hs-var">final_ie</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ItblEnv -&gt; ItblEnv -&gt; ItblEnv) -&gt; ItblEnv -&gt; [ItblEnv] -&gt; ItblEnv
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">ItblEnv -&gt; ItblEnv -&gt; ItblEnv
forall a. NameEnv a -&gt; NameEnv a -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#plusNameEnv"><span class="hs-identifier hs-var">plusNameEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; ItblEnv
</span><a href="GHC.Runtime.Linker.Types.html#itbl_env"><span class="hs-identifier hs-var hs-var">itbl_env</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179398"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ItblEnv]
</span><a href="#local-6989586621681179390"><span class="hs-identifier hs-var">ies</span></a></span><span>
</span><span id="line-1010"></span><span>
</span><span id="line-1011"></span><span>        </span><span id="local-6989586621681179386"><span class="annot"><span class="annottext">[(Name, HValueRef)]
</span><a href="#local-6989586621681179386"><span class="hs-identifier hs-var">names_and_refs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; ItblEnv
-&gt; ClosureEnv
-&gt; [CompiledByteCode]
-&gt; IO [(Name, HValueRef)]
</span><a href="GHC.Runtime.Linker.html#linkSomeBCOs"><span class="hs-identifier hs-var">linkSomeBCOs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179399"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ItblEnv
</span><a href="#local-6989586621681179387"><span class="hs-identifier hs-var">final_ie</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179389"><span class="hs-identifier hs-var">gce</span></a></span><span> </span><span class="annot"><span class="annottext">[CompiledByteCode]
</span><a href="#local-6989586621681179392"><span class="hs-identifier hs-var">cbcs</span></a></span><span>
</span><span id="line-1012"></span><span>
</span><span id="line-1013"></span><span>        </span><span class="hs-comment">-- We only want to add the external ones to the ClosureEnv</span><span>
</span><span id="line-1014"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179385"><span class="annot"><span class="annottext">[(Name, HValueRef)]
</span><a href="#local-6989586621681179385"><span class="hs-identifier hs-var">to_add</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179384"><span class="annot"><span class="annottext">[(Name, HValueRef)]
</span><a href="#local-6989586621681179384"><span class="hs-identifier hs-var">to_drop</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Name, HValueRef) -&gt; Bool)
-&gt; [(Name, HValueRef)]
-&gt; ([(Name, HValueRef)], [(Name, HValueRef)])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isExternalName"><span class="hs-identifier hs-var">isExternalName</span></a></span><span class="annot"><span class="annottext">(Name -&gt; Bool)
-&gt; ((Name, HValueRef) -&gt; Name) -&gt; (Name, HValueRef) -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span class="annot"><span class="annottext">(Name, HValueRef) -&gt; Name
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Name, HValueRef)]
</span><a href="#local-6989586621681179386"><span class="hs-identifier hs-var">names_and_refs</span></a></span><span>
</span><span id="line-1015"></span><span>
</span><span id="line-1016"></span><span>        </span><span class="hs-comment">-- Immediately release any HValueRefs we're not going to add</span><span>
</span><span id="line-1017"></span><span>        </span><span class="annot"><span class="annottext">HscEnv -&gt; [HValueRef] -&gt; IO ()
</span><a href="GHC.Runtime.Interpreter.html#freeHValueRefs"><span class="hs-identifier hs-var">freeHValueRefs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179399"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Name, HValueRef) -&gt; HValueRef)
-&gt; [(Name, HValueRef)] -&gt; [HValueRef]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, HValueRef) -&gt; HValueRef
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, HValueRef)]
</span><a href="#local-6989586621681179384"><span class="hs-identifier hs-var">to_drop</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1018"></span><span>        </span><span class="hs-comment">-- Wrap finalizers on the ones we want to keep</span><span>
</span><span id="line-1019"></span><span>        </span><span id="local-6989586621681179382"><span class="annot"><span class="annottext">[(Name, ForeignHValue)]
</span><a href="#local-6989586621681179382"><span class="hs-identifier hs-var">new_binds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; [(Name, HValueRef)] -&gt; IO [(Name, ForeignHValue)]
</span><a href="GHC.Runtime.Linker.html#makeForeignNamedHValueRefs"><span class="hs-identifier hs-var">makeForeignNamedHValueRefs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179399"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, HValueRef)]
</span><a href="#local-6989586621681179385"><span class="hs-identifier hs-var">to_add</span></a></span><span>
</span><span id="line-1020"></span><span>
</span><span id="line-1021"></span><span>        </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179394"><span class="hs-identifier hs-var">pls1</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">closure_env :: ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var">closure_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureEnv -&gt; [(Name, ForeignHValue)] -&gt; ClosureEnv
</span><a href="GHC.ByteCode.Linker.html#extendClosureEnv"><span class="hs-identifier hs-var">extendClosureEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179389"><span class="hs-identifier hs-var">gce</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, ForeignHValue)]
</span><a href="#local-6989586621681179382"><span class="hs-identifier hs-var">new_binds</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1022"></span><span>                      </span><span class="annot"><span class="annottext">itbl_env :: ItblEnv
</span><a href="GHC.Runtime.Linker.Types.html#itbl_env"><span class="hs-identifier hs-var">itbl_env</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ItblEnv
</span><a href="#local-6989586621681179387"><span class="hs-identifier hs-var">final_ie</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1023"></span><span>
</span><span id="line-1024"></span><span class="hs-comment">-- Link a bunch of BCOs and return references to their values</span><span>
</span><span id="line-1025"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkSomeBCOs"><span class="hs-identifier hs-type">linkSomeBCOs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span>
</span><span id="line-1026"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.ByteCode.Types.html#ItblEnv"><span class="hs-identifier hs-type">ItblEnv</span></a></span><span>
</span><span id="line-1027"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.ByteCode.Linker.html#ClosureEnv"><span class="hs-identifier hs-type">ClosureEnv</span></a></span><span>
</span><span id="line-1028"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.ByteCode.Types.html#CompiledByteCode"><span class="hs-identifier hs-type">CompiledByteCode</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1029"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#HValueRef"><span class="hs-identifier hs-type">HValueRef</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1030"></span><span>                        </span><span class="hs-comment">-- The returned HValueRefs are associated 1-1 with</span><span>
</span><span id="line-1031"></span><span>                        </span><span class="hs-comment">-- the incoming unlinked BCOs.  Each gives the</span><span>
</span><span id="line-1032"></span><span>                        </span><span class="hs-comment">-- value of the corresponding unlinked BCO</span><span>
</span><span id="line-1033"></span><span>
</span><span id="line-1034"></span><span id="linkSomeBCOs"><span class="annot"><span class="annottext">linkSomeBCOs :: HscEnv
-&gt; ItblEnv
-&gt; ClosureEnv
-&gt; [CompiledByteCode]
-&gt; IO [(Name, HValueRef)]
</span><a href="GHC.Runtime.Linker.html#linkSomeBCOs"><span class="hs-identifier hs-var hs-var">linkSomeBCOs</span></a></span></span><span> </span><span id="local-6989586621681179380"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179380"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179379"><span class="annot"><span class="annottext">ItblEnv
</span><a href="#local-6989586621681179379"><span class="hs-identifier hs-var">ie</span></a></span></span><span> </span><span id="local-6989586621681179378"><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179378"><span class="hs-identifier hs-var">ce</span></a></span></span><span> </span><span id="local-6989586621681179377"><span class="annot"><span class="annottext">[CompiledByteCode]
</span><a href="#local-6989586621681179377"><span class="hs-identifier hs-var">mods</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CompiledByteCode
 -&gt; ([(RemoteRef BreakArray, [UnlinkedBCO])]
     -&gt; IO [(Name, HValueRef)])
 -&gt; [(RemoteRef BreakArray, [UnlinkedBCO])]
 -&gt; IO [(Name, HValueRef)])
-&gt; ([(RemoteRef BreakArray, [UnlinkedBCO])]
    -&gt; IO [(Name, HValueRef)])
-&gt; [CompiledByteCode]
-&gt; [(RemoteRef BreakArray, [UnlinkedBCO])]
-&gt; IO [(Name, HValueRef)]
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">CompiledByteCode
-&gt; ([(RemoteRef BreakArray, [UnlinkedBCO])]
    -&gt; IO [(Name, HValueRef)])
-&gt; [(RemoteRef BreakArray, [UnlinkedBCO])]
-&gt; IO [(Name, HValueRef)]
forall {b}.
CompiledByteCode
-&gt; ([(RemoteRef BreakArray, [UnlinkedBCO])] -&gt; IO b)
-&gt; [(RemoteRef BreakArray, [UnlinkedBCO])]
-&gt; IO b
</span><a href="#local-6989586621681179376"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">[(RemoteRef BreakArray, [UnlinkedBCO])] -&gt; IO [(Name, HValueRef)]
</span><a href="#local-6989586621681179375"><span class="hs-identifier hs-var">do_link</span></a></span><span> </span><span class="annot"><span class="annottext">[CompiledByteCode]
</span><a href="#local-6989586621681179377"><span class="hs-identifier hs-var">mods</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1035"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1036"></span><span>  </span><span id="local-6989586621681179376"><span class="annot"><span class="annottext">fun :: CompiledByteCode
-&gt; ([(RemoteRef BreakArray, [UnlinkedBCO])] -&gt; IO b)
-&gt; [(RemoteRef BreakArray, [UnlinkedBCO])]
-&gt; IO b
</span><a href="#local-6989586621681179376"><span class="hs-identifier hs-var hs-var">fun</span></a></span></span><span> </span><span class="annot"><a href="GHC.ByteCode.Types.html#CompiledByteCode"><span class="hs-identifier hs-type">CompiledByteCode</span></a></span><span class="hs-special">{</span><span id="local-6989586621681179370"><span id="local-6989586621681179371"><span id="local-6989586621681179372"><span id="local-6989586621681179373"><span id="local-6989586621681179374"><span class="annot"><span class="annottext">[RemotePtr ()]
[FFIInfo]
[UnlinkedBCO]
Maybe ModBreaks
ItblEnv
bc_breaks :: Maybe ModBreaks
bc_strs :: [RemotePtr ()]
bc_ffis :: [FFIInfo]
bc_itbls :: ItblEnv
bc_bcos :: [UnlinkedBCO]
bc_strs :: CompiledByteCode -&gt; [RemotePtr ()]
bc_itbls :: CompiledByteCode -&gt; ItblEnv
bc_ffis :: CompiledByteCode -&gt; [FFIInfo]
bc_breaks :: CompiledByteCode -&gt; Maybe ModBreaks
bc_bcos :: CompiledByteCode -&gt; [UnlinkedBCO]
</span><a href="#local-6989586621681179370"><span class="hs-glyph hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">..</span></a></span></span></span></span></span></span><span class="hs-special">}</span><span> </span><span id="local-6989586621681179369"><span class="annot"><span class="annottext">[(RemoteRef BreakArray, [UnlinkedBCO])] -&gt; IO b
</span><a href="#local-6989586621681179369"><span class="hs-identifier hs-var">inner</span></a></span></span><span> </span><span id="local-6989586621681179368"><span class="annot"><span class="annottext">[(RemoteRef BreakArray, [UnlinkedBCO])]
</span><a href="#local-6989586621681179368"><span class="hs-identifier hs-var">accum</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1037"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe ModBreaks
</span><a href="#local-6989586621681179370"><span class="hs-identifier hs-var">bc_breaks</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1038"></span><span>      </span><span class="annot"><span class="annottext">Maybe ModBreaks
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[(RemoteRef BreakArray, [UnlinkedBCO])] -&gt; IO b
</span><a href="#local-6989586621681179369"><span class="hs-identifier hs-var">inner</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; RemoteRef BreakArray
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linkSomeBCOs: no break array&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[UnlinkedBCO]
</span><a href="#local-6989586621681179374"><span class="hs-identifier hs-var">bc_bcos</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(RemoteRef BreakArray, [UnlinkedBCO])
-&gt; [(RemoteRef BreakArray, [UnlinkedBCO])]
-&gt; [(RemoteRef BreakArray, [UnlinkedBCO])]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(RemoteRef BreakArray, [UnlinkedBCO])]
</span><a href="#local-6989586621681179368"><span class="hs-identifier hs-var">accum</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1039"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179367"><span class="annot"><span class="annottext">ModBreaks
</span><a href="#local-6989586621681179367"><span class="hs-identifier hs-var">mb</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ForeignRef BreakArray -&gt; (RemoteRef BreakArray -&gt; IO b) -&gt; IO b
forall a b. ForeignRef a -&gt; (RemoteRef a -&gt; IO b) -&gt; IO b
</span><a href="../../ghci/src/GHCi.RemoteTypes.html#withForeignRef"><span class="hs-identifier hs-var">withForeignRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModBreaks -&gt; ForeignRef BreakArray
</span><a href="GHC.ByteCode.Types.html#modBreaks_flags"><span class="hs-identifier hs-var hs-var">modBreaks_flags</span></a></span><span> </span><span class="annot"><span class="annottext">ModBreaks
</span><a href="#local-6989586621681179367"><span class="hs-identifier hs-var">mb</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((RemoteRef BreakArray -&gt; IO b) -&gt; IO b)
-&gt; (RemoteRef BreakArray -&gt; IO b) -&gt; IO b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681179364"><span class="annot"><span class="annottext">RemoteRef BreakArray
</span><a href="#local-6989586621681179364"><span class="hs-identifier hs-var">breakarray</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1040"></span><span>                   </span><span class="annot"><span class="annottext">[(RemoteRef BreakArray, [UnlinkedBCO])] -&gt; IO b
</span><a href="#local-6989586621681179369"><span class="hs-identifier hs-var">inner</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">RemoteRef BreakArray
</span><a href="#local-6989586621681179364"><span class="hs-identifier hs-var">breakarray</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[UnlinkedBCO]
</span><a href="#local-6989586621681179374"><span class="hs-identifier hs-var">bc_bcos</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(RemoteRef BreakArray, [UnlinkedBCO])
-&gt; [(RemoteRef BreakArray, [UnlinkedBCO])]
-&gt; [(RemoteRef BreakArray, [UnlinkedBCO])]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(RemoteRef BreakArray, [UnlinkedBCO])]
</span><a href="#local-6989586621681179368"><span class="hs-identifier hs-var">accum</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1041"></span><span>
</span><span id="line-1042"></span><span>  </span><span id="local-6989586621681179375"><span class="annot"><span class="annottext">do_link :: [(RemoteRef BreakArray, [UnlinkedBCO])] -&gt; IO [(Name, HValueRef)]
</span><a href="#local-6989586621681179375"><span class="hs-identifier hs-var hs-var">do_link</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, HValueRef)] -&gt; IO [(Name, HValueRef)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1043"></span><span>  </span><span class="annot"><a href="#local-6989586621681179375"><span class="hs-identifier hs-var">do_link</span></a></span><span> </span><span id="local-6989586621681179357"><span class="annot"><span class="annottext">[(RemoteRef BreakArray, [UnlinkedBCO])]
</span><a href="#local-6989586621681179357"><span class="hs-identifier hs-var">mods</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1044"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179356"><span class="annot"><span class="annottext">flat :: [(RemoteRef BreakArray, UnlinkedBCO)]
</span><a href="#local-6989586621681179356"><span class="hs-identifier hs-var hs-var">flat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RemoteRef BreakArray
</span><a href="#local-6989586621681179355"><span class="hs-identifier hs-var">breakarray</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">UnlinkedBCO
</span><a href="#local-6989586621681179354"><span class="hs-identifier hs-var">bco</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179355"><span class="annot"><span class="annottext">RemoteRef BreakArray
</span><a href="#local-6989586621681179355"><span class="hs-identifier hs-var">breakarray</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179353"><span class="annot"><span class="annottext">[UnlinkedBCO]
</span><a href="#local-6989586621681179353"><span class="hs-identifier hs-var">bcos</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(RemoteRef BreakArray, [UnlinkedBCO])]
</span><a href="#local-6989586621681179357"><span class="hs-identifier hs-var">mods</span></a></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179354"><span class="annot"><span class="annottext">UnlinkedBCO
</span><a href="#local-6989586621681179354"><span class="hs-identifier hs-var">bco</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[UnlinkedBCO]
</span><a href="#local-6989586621681179353"><span class="hs-identifier hs-var">bcos</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1045"></span><span>        </span><span id="local-6989586621681179352"><span class="annot"><span class="annottext">names :: [Name]
</span><a href="#local-6989586621681179352"><span class="hs-identifier hs-var hs-var">names</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((RemoteRef BreakArray, UnlinkedBCO) -&gt; Name)
-&gt; [(RemoteRef BreakArray, UnlinkedBCO)] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnlinkedBCO -&gt; Name
</span><a href="GHC.ByteCode.Types.html#unlinkedBCOName"><span class="hs-identifier hs-var hs-var">unlinkedBCOName</span></a></span><span> </span><span class="annot"><span class="annottext">(UnlinkedBCO -&gt; Name)
-&gt; ((RemoteRef BreakArray, UnlinkedBCO) -&gt; UnlinkedBCO)
-&gt; (RemoteRef BreakArray, UnlinkedBCO)
-&gt; Name
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(RemoteRef BreakArray, UnlinkedBCO) -&gt; UnlinkedBCO
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(RemoteRef BreakArray, UnlinkedBCO)]
</span><a href="#local-6989586621681179356"><span class="hs-identifier hs-var">flat</span></a></span><span>
</span><span id="line-1046"></span><span>        </span><span id="local-6989586621681179348"><span class="annot"><span class="annottext">bco_ix :: NameEnv Int
</span><a href="#local-6989586621681179348"><span class="hs-identifier hs-var hs-var">bco_ix</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, Int)] -&gt; NameEnv Int
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Name] -&gt; [Int] -&gt; [(Name, Int)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681179352"><span class="hs-identifier hs-var">names</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-glyph">..</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1047"></span><span>    </span><span id="local-6989586621681179347"><span class="annot"><span class="annottext">[ResolvedBCO]
</span><a href="#local-6989586621681179347"><span class="hs-identifier hs-var">resolved</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[IO ResolvedBCO] -&gt; IO [ResolvedBCO]
forall (t :: * -&gt; *) (m :: * -&gt; *) a.
(Traversable t, Monad m) =&gt;
t (m a) -&gt; m (t a)
</span><a href="../../base/src/Data.Traversable.html#sequence"><span class="hs-identifier hs-var">sequence</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; ItblEnv
-&gt; ClosureEnv
-&gt; NameEnv Int
-&gt; RemoteRef BreakArray
-&gt; UnlinkedBCO
-&gt; IO ResolvedBCO
</span><a href="GHC.ByteCode.Linker.html#linkBCO"><span class="hs-identifier hs-var">linkBCO</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179380"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ItblEnv
</span><a href="#local-6989586621681179379"><span class="hs-identifier hs-var">ie</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179378"><span class="hs-identifier hs-var">ce</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv Int
</span><a href="#local-6989586621681179348"><span class="hs-identifier hs-var">bco_ix</span></a></span><span> </span><span class="annot"><span class="annottext">RemoteRef BreakArray
</span><a href="#local-6989586621681179345"><span class="hs-identifier hs-var">breakarray</span></a></span><span> </span><span class="annot"><span class="annottext">UnlinkedBCO
</span><a href="#local-6989586621681179344"><span class="hs-identifier hs-var">bco</span></a></span><span>
</span><span id="line-1048"></span><span>                         </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179345"><span class="annot"><span class="annottext">RemoteRef BreakArray
</span><a href="#local-6989586621681179345"><span class="hs-identifier hs-var">breakarray</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179344"><span class="annot"><span class="annottext">UnlinkedBCO
</span><a href="#local-6989586621681179344"><span class="hs-identifier hs-var">bco</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(RemoteRef BreakArray, UnlinkedBCO)]
</span><a href="#local-6989586621681179356"><span class="hs-identifier hs-var">flat</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1049"></span><span>    </span><span id="local-6989586621681179343"><span class="annot"><span class="annottext">[HValueRef]
</span><a href="#local-6989586621681179343"><span class="hs-identifier hs-var">hvrefs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; [ResolvedBCO] -&gt; IO [HValueRef]
</span><a href="GHC.Runtime.Interpreter.html#createBCOs"><span class="hs-identifier hs-var">createBCOs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179380"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">[ResolvedBCO]
</span><a href="#local-6989586621681179347"><span class="hs-identifier hs-var">resolved</span></a></span><span>
</span><span id="line-1050"></span><span>    </span><span class="annot"><span class="annottext">[(Name, HValueRef)] -&gt; IO [(Name, HValueRef)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Name] -&gt; [HValueRef] -&gt; [(Name, HValueRef)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681179352"><span class="hs-identifier hs-var">names</span></a></span><span> </span><span class="annot"><span class="annottext">[HValueRef]
</span><a href="#local-6989586621681179343"><span class="hs-identifier hs-var">hvrefs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1051"></span><span>
</span><span id="line-1052"></span><span class="hs-comment">-- | Useful to apply to the result of 'linkSomeBCOs'</span><span>
</span><span id="line-1053"></span><span class="annot"><a href="GHC.Runtime.Linker.html#makeForeignNamedHValueRefs"><span class="hs-identifier hs-type">makeForeignNamedHValueRefs</span></a></span><span>
</span><span id="line-1054"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#HValueRef"><span class="hs-identifier hs-type">HValueRef</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#ForeignHValue"><span class="hs-identifier hs-type">ForeignHValue</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1055"></span><span id="makeForeignNamedHValueRefs"><span class="annot"><span class="annottext">makeForeignNamedHValueRefs :: HscEnv -&gt; [(Name, HValueRef)] -&gt; IO [(Name, ForeignHValue)]
</span><a href="GHC.Runtime.Linker.html#makeForeignNamedHValueRefs"><span class="hs-identifier hs-var hs-var">makeForeignNamedHValueRefs</span></a></span></span><span> </span><span id="local-6989586621681179342"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179342"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179341"><span class="annot"><span class="annottext">[(Name, HValueRef)]
</span><a href="#local-6989586621681179341"><span class="hs-identifier hs-var">bindings</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1056"></span><span>  </span><span class="annot"><span class="annottext">((Name, HValueRef) -&gt; IO (Name, ForeignHValue))
-&gt; [(Name, HValueRef)] -&gt; IO [(Name, ForeignHValue)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621681179340"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179340"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179339"><span class="annot"><span class="annottext">HValueRef
</span><a href="#local-6989586621681179339"><span class="hs-identifier hs-var">hvref</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179340"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(ForeignHValue -&gt; (Name, ForeignHValue))
-&gt; IO ForeignHValue -&gt; IO (Name, ForeignHValue)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; HValueRef -&gt; IO ForeignHValue
forall a. HscEnv -&gt; RemoteRef a -&gt; IO (ForeignRef a)
</span><a href="GHC.Runtime.Interpreter.html#mkFinalizedHValue"><span class="hs-identifier hs-var">mkFinalizedHValue</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179342"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">HValueRef
</span><a href="#local-6989586621681179339"><span class="hs-identifier hs-var">hvref</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Name, HValueRef)]
</span><a href="#local-6989586621681179341"><span class="hs-identifier hs-var">bindings</span></a></span><span>
</span><span id="line-1057"></span><span>
</span><span id="line-1058"></span><span class="hs-comment">{- **********************************************************************

                Unload some object modules

  ********************************************************************* -}</span><span>
</span><span id="line-1063"></span><span>
</span><span id="line-1064"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-1065"></span><span class="hs-comment">-- | Unloading old objects ready for a new compilation sweep.</span><span>
</span><span id="line-1066"></span><span class="hs-comment">--</span><span>
</span><span id="line-1067"></span><span class="hs-comment">-- The compilation manager provides us with a list of linkables that it</span><span>
</span><span id="line-1068"></span><span class="hs-comment">-- considers \&quot;stable\&quot;, i.e. won't be recompiled this time around.  For</span><span>
</span><span id="line-1069"></span><span class="hs-comment">-- each of the modules current linked in memory,</span><span>
</span><span id="line-1070"></span><span class="hs-comment">--</span><span>
</span><span id="line-1071"></span><span class="hs-comment">--   * if the linkable is stable (and it's the same one -- the user may have</span><span>
</span><span id="line-1072"></span><span class="hs-comment">--     recompiled the module on the side), we keep it,</span><span>
</span><span id="line-1073"></span><span class="hs-comment">--</span><span>
</span><span id="line-1074"></span><span class="hs-comment">--   * otherwise, we unload it.</span><span>
</span><span id="line-1075"></span><span class="hs-comment">--</span><span>
</span><span id="line-1076"></span><span class="hs-comment">--   * we also implicitly unload all temporary bindings at this point.</span><span>
</span><span id="line-1077"></span><span class="hs-comment">--</span><span>
</span><span id="line-1078"></span><span class="annot"><a href="GHC.Runtime.Linker.html#unload"><span class="hs-identifier hs-type">unload</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span>
</span><span id="line-1079"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- ^ The linkables to *keep*.</span><span>
</span><span id="line-1080"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1081"></span><span id="unload"><span class="annot"><span class="annottext">unload :: HscEnv -&gt; [Linkable] -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#unload"><span class="hs-identifier hs-var hs-var">unload</span></a></span></span><span> </span><span id="local-6989586621681179338"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179338"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179337"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179337"><span class="hs-identifier hs-var">linkables</span></a></span></span><span>
</span><span id="line-1082"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IO ()
forall a. IO a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#mask_"><span class="hs-identifier hs-var">mask_</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-comment">-- mask, so we're safe from Ctrl-C in here</span><span>
</span><span id="line-1083"></span><span>
</span><span id="line-1084"></span><span>        </span><span class="hs-comment">-- Initialise the linker (if it's not been done already)</span><span>
</span><span id="line-1085"></span><span>        </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#initDynLinker"><span class="hs-identifier hs-var">initDynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179338"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1086"></span><span>
</span><span id="line-1087"></span><span>        </span><span class="hs-comment">-- Extract DynLinker for passing into required places</span><span>
</span><span id="line-1088"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179336"><span class="annot"><span class="annottext">dl :: DynLinker
</span><a href="#local-6989586621681179336"><span class="hs-identifier hs-var hs-var">dl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynLinker
</span><a href="GHC.Driver.Types.html#hsc_dynLinker"><span class="hs-identifier hs-var hs-var">hsc_dynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179338"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1089"></span><span>
</span><span id="line-1090"></span><span>        </span><span id="local-6989586621681179335"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179335"><span class="hs-identifier hs-var">new_pls</span></a></span></span><span>
</span><span id="line-1091"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState
    -&gt; IO (PersistentLinkerState, PersistentLinkerState))
-&gt; IO PersistentLinkerState
forall a.
DynLinker
-&gt; (PersistentLinkerState -&gt; IO (PersistentLinkerState, a)) -&gt; IO a
</span><a href="GHC.Runtime.Linker.html#modifyPLS"><span class="hs-identifier hs-var">modifyPLS</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179336"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState
  -&gt; IO (PersistentLinkerState, PersistentLinkerState))
 -&gt; IO PersistentLinkerState)
-&gt; (PersistentLinkerState
    -&gt; IO (PersistentLinkerState, PersistentLinkerState))
-&gt; IO PersistentLinkerState
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681179334"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179334"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1092"></span><span>                 </span><span id="local-6989586621681179333"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179333"><span class="hs-identifier hs-var">pls1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; [Linkable] -&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#unload_wkr"><span class="hs-identifier hs-var">unload_wkr</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179338"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179337"><span class="hs-identifier hs-var">linkables</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179334"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-1093"></span><span>                 </span><span class="annot"><span class="annottext">(PersistentLinkerState, PersistentLinkerState)
-&gt; IO (PersistentLinkerState, PersistentLinkerState)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179333"><span class="hs-identifier hs-var">pls1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179333"><span class="hs-identifier hs-var">pls1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1094"></span><span>
</span><span id="line-1095"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179332"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681179332"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179338"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1096"></span><span>        </span><span class="annot"><span class="annottext">DynFlags -&gt; Int -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#debugTraceMsg"><span class="hs-identifier hs-var">debugTraceMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179332"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO ()) -&gt; SDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1097"></span><span>          </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unload: retaining objs&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#objs_loaded"><span class="hs-identifier hs-var hs-var">objs_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179335"><span class="hs-identifier hs-var">new_pls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1098"></span><span>        </span><span class="annot"><span class="annottext">DynFlags -&gt; Int -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#debugTraceMsg"><span class="hs-identifier hs-var">debugTraceMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179332"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO ()) -&gt; SDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1099"></span><span>          </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unload: retaining bcos&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#bcos_loaded"><span class="hs-identifier hs-var hs-var">bcos_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179335"><span class="hs-identifier hs-var">new_pls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1100"></span><span>        </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1101"></span><span>
</span><span id="line-1102"></span><span class="annot"><a href="GHC.Runtime.Linker.html#unload_wkr"><span class="hs-identifier hs-type">unload_wkr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span>
</span><span id="line-1103"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span class="hs-special">]</span><span>                </span><span class="hs-comment">-- stable linkables</span><span>
</span><span id="line-1104"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-1105"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-1106"></span><span class="hs-comment">-- Does the core unload business</span><span>
</span><span id="line-1107"></span><span class="hs-comment">-- (the wrapper blocks exceptions and deals with the PLS get and put)</span><span>
</span><span id="line-1108"></span><span>
</span><span id="line-1109"></span><span id="unload_wkr"><span class="annot"><span class="annottext">unload_wkr :: HscEnv
-&gt; [Linkable] -&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#unload_wkr"><span class="hs-identifier hs-var hs-var">unload_wkr</span></a></span></span><span> </span><span id="local-6989586621681179330"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179330"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179329"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179329"><span class="hs-identifier hs-var">keep_linkables</span></a></span></span><span> </span><span id="local-6989586621681179328"><span class="annot"><span class="annottext">pls :: PersistentLinkerState
</span><a href="#local-6989586621681179328"><span class="hs-identifier hs-var">pls</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span class="hs-special">{</span><span id="local-6989586621681179322"><span id="local-6989586621681179323"><span id="local-6989586621681179324"><span id="local-6989586621681179325"><span id="local-6989586621681179326"><span id="local-6989586621681179327"><span class="annot"><span class="annottext">[(String, String)]
[UnitId]
[Linkable]
ClosureEnv
ItblEnv
temp_sos :: [(String, String)]
pkgs_loaded :: [UnitId]
objs_loaded :: [Linkable]
bcos_loaded :: [Linkable]
itbl_env :: ItblEnv
closure_env :: ClosureEnv
temp_sos :: PersistentLinkerState -&gt; [(String, String)]
objs_loaded :: PersistentLinkerState -&gt; [Linkable]
bcos_loaded :: PersistentLinkerState -&gt; [Linkable]
pkgs_loaded :: PersistentLinkerState -&gt; [UnitId]
itbl_env :: PersistentLinkerState -&gt; ItblEnv
closure_env :: PersistentLinkerState -&gt; ClosureEnv
</span><a href="#local-6989586621681179322"><span class="hs-glyph hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">..</span></a></span></span></span></span></span></span></span><span class="hs-special">}</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1110"></span><span>  </span><span class="hs-comment">-- NB. careful strictness here to avoid keeping the old PLS when</span><span>
</span><span id="line-1111"></span><span>  </span><span class="hs-comment">-- we're unloading some code.  -fghci-leak-check with the tests in</span><span>
</span><span id="line-1112"></span><span>  </span><span class="hs-comment">-- testsuite/ghci can detect space leaks here.</span><span>
</span><span id="line-1113"></span><span>
</span><span id="line-1114"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179321"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179321"><span class="hs-identifier hs-var">objs_to_keep</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179320"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179320"><span class="hs-identifier hs-var">bcos_to_keep</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Linkable -&gt; Bool) -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; Bool
</span><a href="GHC.Driver.Types.html#isObjectLinkable"><span class="hs-identifier hs-var">isObjectLinkable</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179329"><span class="hs-identifier hs-var">keep_linkables</span></a></span><span>
</span><span id="line-1115"></span><span>
</span><span id="line-1116"></span><span>      </span><span id="local-6989586621681179319"><span class="annot"><span class="annottext">discard :: [Linkable] -&gt; Linkable -&gt; Bool
</span><a href="#local-6989586621681179319"><span class="hs-identifier hs-var hs-var">discard</span></a></span></span><span> </span><span id="local-6989586621681179318"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179318"><span class="hs-identifier hs-var">keep</span></a></span></span><span> </span><span id="local-6989586621681179317"><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179317"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Linkable -&gt; [Linkable] -&gt; Bool
</span><a href="GHC.Runtime.Linker.html#linkableInSet"><span class="hs-identifier hs-var">linkableInSet</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179317"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179318"><span class="hs-identifier hs-var">keep</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1117"></span><span>
</span><span id="line-1118"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621681179316"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179316"><span class="hs-identifier hs-var">objs_to_unload</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179315"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179315"><span class="hs-identifier hs-var">remaining_objs_loaded</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1119"></span><span>         </span><span class="annot"><span class="annottext">(Linkable -&gt; Bool) -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Linkable] -&gt; Linkable -&gt; Bool
</span><a href="#local-6989586621681179319"><span class="hs-identifier hs-var">discard</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179321"><span class="hs-identifier hs-var">objs_to_keep</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179324"><span class="hs-identifier hs-var">objs_loaded</span></a></span><span>
</span><span id="line-1120"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621681179314"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179314"><span class="hs-identifier hs-var">bcos_to_unload</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179313"><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179313"><span class="hs-identifier hs-var">remaining_bcos_loaded</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1121"></span><span>         </span><span class="annot"><span class="annottext">(Linkable -&gt; Bool) -&gt; [Linkable] -&gt; ([Linkable], [Linkable])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Linkable] -&gt; Linkable -&gt; Bool
</span><a href="#local-6989586621681179319"><span class="hs-identifier hs-var">discard</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179320"><span class="hs-identifier hs-var">bcos_to_keep</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179325"><span class="hs-identifier hs-var">bcos_loaded</span></a></span><span>
</span><span id="line-1122"></span><span>
</span><span id="line-1123"></span><span>  </span><span class="annot"><span class="annottext">(Linkable -&gt; IO ()) -&gt; [Linkable] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; IO ()
</span><a href="#local-6989586621681179312"><span class="hs-identifier hs-var">unloadObjs</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179316"><span class="hs-identifier hs-var">objs_to_unload</span></a></span><span>
</span><span id="line-1124"></span><span>  </span><span class="annot"><span class="annottext">(Linkable -&gt; IO ()) -&gt; [Linkable] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; IO ()
</span><a href="#local-6989586621681179312"><span class="hs-identifier hs-var">unloadObjs</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179314"><span class="hs-identifier hs-var">bcos_to_unload</span></a></span><span>
</span><span id="line-1125"></span><span>
</span><span id="line-1126"></span><span>  </span><span class="hs-comment">-- If we unloaded any object files at all, we need to purge the cache</span><span>
</span><span id="line-1127"></span><span>  </span><span class="hs-comment">-- of lookupSymbol results.</span><span>
</span><span id="line-1128"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Linkable] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179316"><span class="hs-identifier hs-var">objs_to_unload</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable] -&gt; [Linkable] -&gt; [Linkable]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span>
</span><span id="line-1129"></span><span>                   </span><span class="annot"><span class="annottext">(Linkable -&gt; Bool) -&gt; [Linkable] -&gt; [Linkable]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Linkable -&gt; Bool) -&gt; Linkable -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; Bool) -&gt; (Linkable -&gt; [String]) -&gt; Linkable -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; [String]
</span><a href="GHC.Driver.Types.html#linkableObjs"><span class="hs-identifier hs-var">linkableObjs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179314"><span class="hs-identifier hs-var">bcos_to_unload</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1130"></span><span>    </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Interpreter.html#purgeLookupSymbolCache"><span class="hs-identifier hs-var">purgeLookupSymbolCache</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179330"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1131"></span><span>
</span><span id="line-1132"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621681179309"><span class="annot"><span class="annottext">bcos_retained :: ModuleSet
</span><a href="#local-6989586621681179309"><span class="hs-identifier hs-var hs-var">bcos_retained</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Module] -&gt; ModuleSet
</span><a href="GHC.Unit.Module.Env.html#mkModuleSet"><span class="hs-identifier hs-var">mkModuleSet</span></a></span><span> </span><span class="annot"><span class="annottext">([Module] -&gt; ModuleSet) -&gt; [Module] -&gt; ModuleSet
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Linkable -&gt; Module) -&gt; [Linkable] -&gt; [Module]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; Module
</span><a href="GHC.Runtime.Linker.Types.html#linkableModule"><span class="hs-identifier hs-var hs-var">linkableModule</span></a></span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179313"><span class="hs-identifier hs-var">remaining_bcos_loaded</span></a></span><span>
</span><span id="line-1133"></span><span>
</span><span id="line-1134"></span><span>      </span><span class="hs-comment">-- Note that we want to remove all *local*</span><span>
</span><span id="line-1135"></span><span>      </span><span class="hs-comment">-- (i.e. non-isExternal) names too (these are the</span><span>
</span><span id="line-1136"></span><span>      </span><span class="hs-comment">-- temporary bindings from the command line).</span><span>
</span><span id="line-1137"></span><span>      </span><span id="local-6989586621681179306"><span class="annot"><span class="annottext">keep_name :: (Name, b) -&gt; Bool
</span><a href="#local-6989586621681179306"><span class="hs-identifier hs-var hs-var">keep_name</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179305"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179305"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isExternalName"><span class="hs-identifier hs-var">isExternalName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179305"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-1138"></span><span>                        </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Module
Name -&gt; Module
</span><a href="GHC.Types.Name.html#nameModule"><span class="hs-identifier hs-var">nameModule</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681179305"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; ModuleSet -&gt; Bool
</span><a href="GHC.Unit.Module.Env.html#elemModuleSet"><span class="hs-operator hs-var">`elemModuleSet`</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleSet
</span><a href="#local-6989586621681179309"><span class="hs-identifier hs-var">bcos_retained</span></a></span><span>
</span><span id="line-1139"></span><span>
</span><span id="line-1140"></span><span>      </span><span id="local-6989586621681179303"><span class="annot"><span class="annottext">itbl_env' :: ItblEnv
</span><a href="#local-6989586621681179303"><span class="hs-identifier hs-var hs-var">itbl_env'</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Name, ItblPtr) -&gt; Bool) -&gt; ItblEnv -&gt; ItblEnv
forall elt. (elt -&gt; Bool) -&gt; NameEnv elt -&gt; NameEnv elt
</span><a href="GHC.Types.Name.Env.html#filterNameEnv"><span class="hs-identifier hs-var">filterNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, ItblPtr) -&gt; Bool
forall {b}. (Name, b) -&gt; Bool
</span><a href="#local-6989586621681179306"><span class="hs-identifier hs-var">keep_name</span></a></span><span> </span><span class="annot"><span class="annottext">ItblEnv
</span><a href="#local-6989586621681179326"><span class="hs-identifier hs-var">itbl_env</span></a></span><span>
</span><span id="line-1141"></span><span>      </span><span id="local-6989586621681179301"><span class="annot"><span class="annottext">closure_env' :: ClosureEnv
</span><a href="#local-6989586621681179301"><span class="hs-identifier hs-var hs-var">closure_env'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Name, ForeignHValue) -&gt; Bool) -&gt; ClosureEnv -&gt; ClosureEnv
forall elt. (elt -&gt; Bool) -&gt; NameEnv elt -&gt; NameEnv elt
</span><a href="GHC.Types.Name.Env.html#filterNameEnv"><span class="hs-identifier hs-var">filterNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, ForeignHValue) -&gt; Bool
forall {b}. (Name, b) -&gt; Bool
</span><a href="#local-6989586621681179306"><span class="hs-identifier hs-var">keep_name</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179327"><span class="hs-identifier hs-var">closure_env</span></a></span><span>
</span><span id="line-1142"></span><span>
</span><span id="line-1143"></span><span>      </span><span class="hs-glyph">!</span><span id="local-6989586621681179300"><span class="annot"><span class="annottext">new_pls :: PersistentLinkerState
</span><a href="#local-6989586621681179300"><span class="hs-identifier hs-var hs-var">new_pls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179328"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">itbl_env :: ItblEnv
</span><a href="GHC.Runtime.Linker.Types.html#itbl_env"><span class="hs-identifier hs-var">itbl_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ItblEnv
</span><a href="#local-6989586621681179303"><span class="hs-identifier hs-var">itbl_env'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1144"></span><span>                       </span><span class="annot"><span class="annottext">closure_env :: ClosureEnv
</span><a href="GHC.Runtime.Linker.Types.html#closure_env"><span class="hs-identifier hs-var">closure_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureEnv
</span><a href="#local-6989586621681179301"><span class="hs-identifier hs-var">closure_env'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1145"></span><span>                       </span><span class="annot"><span class="annottext">bcos_loaded :: [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#bcos_loaded"><span class="hs-identifier hs-var">bcos_loaded</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179313"><span class="hs-identifier hs-var">remaining_bcos_loaded</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1146"></span><span>                       </span><span class="annot"><span class="annottext">objs_loaded :: [Linkable]
</span><a href="GHC.Runtime.Linker.Types.html#objs_loaded"><span class="hs-identifier hs-var">objs_loaded</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Linkable]
</span><a href="#local-6989586621681179315"><span class="hs-identifier hs-var">remaining_objs_loaded</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1147"></span><span>
</span><span id="line-1148"></span><span>  </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179300"><span class="hs-identifier hs-var">new_pls</span></a></span><span>
</span><span id="line-1149"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1150"></span><span>    </span><span class="annot"><a href="#local-6989586621681179312"><span class="hs-identifier hs-type">unloadObjs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#Linkable"><span class="hs-identifier hs-type">Linkable</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1151"></span><span>    </span><span id="local-6989586621681179312"><span class="annot"><span class="annottext">unloadObjs :: Linkable -&gt; IO ()
</span><a href="#local-6989586621681179312"><span class="hs-identifier hs-var hs-var">unloadObjs</span></a></span></span><span> </span><span id="local-6989586621681179299"><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179299"><span class="hs-identifier hs-var">lnk</span></a></span></span><span>
</span><span id="line-1152"></span><span>        </span><span class="hs-comment">-- The RTS's PEi386 linker currently doesn't support unloading.</span><span>
</span><span id="line-1153"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Utils.Misc.html#isWindowsHost"><span class="hs-identifier hs-var">isWindowsHost</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1154"></span><span>
</span><span id="line-1155"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Driver.Ways.html#hostIsDynamic"><span class="hs-identifier hs-var">hostIsDynamic</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1156"></span><span>        </span><span class="hs-comment">-- We don't do any cleanup when linking objects with the</span><span>
</span><span id="line-1157"></span><span>        </span><span class="hs-comment">-- dynamic linker.  Doing so introduces extra complexity for</span><span>
</span><span id="line-1158"></span><span>        </span><span class="hs-comment">-- not much benefit.</span><span>
</span><span id="line-1159"></span><span>
</span><span id="line-1160"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1161"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO ()) -&gt; [String] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Interpreter.html#unloadObj"><span class="hs-identifier hs-var">unloadObj</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179330"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179296"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#DotO"><span class="hs-identifier hs-type">DotO</span></a></span><span> </span><span id="local-6989586621681179296"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179296"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Linkable -&gt; [Unlinked]
</span><a href="GHC.Runtime.Linker.Types.html#linkableUnlinked"><span class="hs-identifier hs-var hs-var">linkableUnlinked</span></a></span><span> </span><span class="annot"><span class="annottext">Linkable
</span><a href="#local-6989586621681179299"><span class="hs-identifier hs-var">lnk</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1162"></span><span>                </span><span class="hs-comment">-- The components of a BCO linkable may contain</span><span>
</span><span id="line-1163"></span><span>                </span><span class="hs-comment">-- dot-o files.  Which is very confusing.</span><span>
</span><span id="line-1164"></span><span>                </span><span class="hs-comment">--</span><span>
</span><span id="line-1165"></span><span>                </span><span class="hs-comment">-- But the BCO parts can be unlinked just by</span><span>
</span><span id="line-1166"></span><span>                </span><span class="hs-comment">-- letting go of them (plus of course depopulating</span><span>
</span><span id="line-1167"></span><span>                </span><span class="hs-comment">-- the symbol table which is done in the main body)</span><span>
</span><span id="line-1168"></span><span>
</span><span id="line-1169"></span><span class="hs-comment">{- **********************************************************************

                Loading packages

  ********************************************************************* -}</span><span>
</span><span id="line-1174"></span><span>
</span><span id="line-1175"></span><span class="hs-keyword">data</span><span> </span><span id="LibrarySpec"><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-var">LibrarySpec</span></a></span></span><span>
</span><span id="line-1176"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="Objects"><span class="annot"><a href="GHC.Runtime.Linker.html#Objects"><span class="hs-identifier hs-var">Objects</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- Full path names of set of .o files, including trailing .o</span><span>
</span><span id="line-1177"></span><span>                        </span><span class="hs-comment">-- We allow batched loading to ensure that cyclic symbol</span><span>
</span><span id="line-1178"></span><span>                        </span><span class="hs-comment">-- references can be resolved (see #13786).</span><span>
</span><span id="line-1179"></span><span>                        </span><span class="hs-comment">-- For dynamic objects only, try to find the object</span><span>
</span><span id="line-1180"></span><span>                        </span><span class="hs-comment">-- file in all the directories specified in</span><span>
</span><span id="line-1181"></span><span>                        </span><span class="hs-comment">-- v_Library_paths before giving up.</span><span>
</span><span id="line-1182"></span><span>
</span><span id="line-1183"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="Archive"><span class="annot"><a href="GHC.Runtime.Linker.html#Archive"><span class="hs-identifier hs-var">Archive</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>   </span><span class="hs-comment">-- Full path name of a .a file, including trailing .a</span><span>
</span><span id="line-1184"></span><span>
</span><span id="line-1185"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="DLL"><span class="annot"><a href="GHC.Runtime.Linker.html#DLL"><span class="hs-identifier hs-var">DLL</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>         </span><span class="hs-comment">-- &quot;Unadorned&quot; name of a .DLL/.so</span><span>
</span><span id="line-1186"></span><span>                        </span><span class="hs-comment">--  e.g.    On unix     &quot;qt&quot;  denotes &quot;libqt.so&quot;</span><span>
</span><span id="line-1187"></span><span>                        </span><span class="hs-comment">--          On Windows  &quot;burble&quot;  denotes &quot;burble.DLL&quot; or &quot;libburble.dll&quot;</span><span>
</span><span id="line-1188"></span><span>                        </span><span class="hs-comment">--  loadDLL is platform-specific and adds the lib/.so/.DLL</span><span>
</span><span id="line-1189"></span><span>                        </span><span class="hs-comment">--  suffixes platform-dependently</span><span>
</span><span id="line-1190"></span><span>
</span><span id="line-1191"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="DLLPath"><span class="annot"><a href="GHC.Runtime.Linker.html#DLLPath"><span class="hs-identifier hs-var">DLLPath</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>   </span><span class="hs-comment">-- Absolute or relative pathname to a dynamic library</span><span>
</span><span id="line-1192"></span><span>                        </span><span class="hs-comment">-- (ends with .dll or .so).</span><span>
</span><span id="line-1193"></span><span>
</span><span id="line-1194"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="Framework"><span class="annot"><a href="GHC.Runtime.Linker.html#Framework"><span class="hs-identifier hs-var">Framework</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>   </span><span class="hs-comment">-- Only used for darwin, but does no harm</span><span>
</span><span id="line-1195"></span><span>
</span><span id="line-1196"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681179293"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-type">LibrarySpec</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1197"></span><span>  </span><span id="local-6989586621681179287"><span class="annot"><span class="annottext">ppr :: LibrarySpec -&gt; SDoc
</span><a href="#local-6989586621681179287"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#Objects"><span class="hs-identifier hs-type">Objects</span></a></span><span> </span><span id="local-6989586621681179286"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179286"><span class="hs-identifier hs-var">objs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Objects&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179286"><span class="hs-identifier hs-var">objs</span></a></span><span>
</span><span id="line-1198"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#Archive"><span class="hs-identifier hs-type">Archive</span></a></span><span> </span><span id="local-6989586621681179285"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179285"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Archive&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179285"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-1199"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#DLL"><span class="hs-identifier hs-type">DLL</span></a></span><span> </span><span id="local-6989586621681179284"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179284"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;DLL&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179284"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1200"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#DLLPath"><span class="hs-identifier hs-type">DLLPath</span></a></span><span> </span><span id="local-6989586621681179283"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179283"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;DLLPath&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179283"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-1201"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#Framework"><span class="hs-identifier hs-type">Framework</span></a></span><span> </span><span id="local-6989586621681179282"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179282"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Framework&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179282"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1202"></span><span>
</span><span id="line-1203"></span><span class="hs-comment">-- If this package is already part of the GHCi binary, we'll already</span><span>
</span><span id="line-1204"></span><span class="hs-comment">-- have the right DLLs for this package loaded, so don't try to</span><span>
</span><span id="line-1205"></span><span class="hs-comment">-- load them again.</span><span>
</span><span id="line-1206"></span><span class="hs-comment">--</span><span>
</span><span id="line-1207"></span><span class="hs-comment">-- But on Win32 we must load them 'again'; doing so is a harmless no-op</span><span>
</span><span id="line-1208"></span><span class="hs-comment">-- as far as the loader is concerned, but it does initialise the list</span><span>
</span><span id="line-1209"></span><span class="hs-comment">-- of DLL handles that rts/Linker.c maintains, and that in turn is</span><span>
</span><span id="line-1210"></span><span class="hs-comment">-- used by lookupSymbol.  So we must call addDLL for each library</span><span>
</span><span id="line-1211"></span><span class="hs-comment">-- just to get the DLL handle into the list.</span><span>
</span><span id="line-1212"></span><span class="annot"><a href="GHC.Runtime.Linker.html#partOfGHCi"><span class="hs-identifier hs-type">partOfGHCi</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Info.html#PackageName"><span class="hs-identifier hs-type">PackageName</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1213"></span><span id="partOfGHCi"><span class="annot"><span class="annottext">partOfGHCi :: [PackageName]
</span><a href="GHC.Runtime.Linker.html#partOfGHCi"><span class="hs-identifier hs-var hs-var">partOfGHCi</span></a></span></span><span>
</span><span id="line-1214"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Utils.Misc.html#isWindowsHost"><span class="hs-identifier hs-var">isWindowsHost</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Utils.Misc.html#isDarwinHost"><span class="hs-identifier hs-var">isDarwinHost</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1215"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; PackageName) -&gt; [String] -&gt; [PackageName]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; PackageName
</span><a href="GHC.Unit.Info.html#PackageName"><span class="hs-identifier hs-var">PackageName</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; PackageName)
-&gt; (String -&gt; FastString) -&gt; String -&gt; PackageName
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1216"></span><span>                   </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;base&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;template-haskell&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;editline&quot;</span></span><span class="hs-special">]</span><span>
</span><span id="line-1217"></span><span>
</span><span id="line-1218"></span><span class="annot"><a href="GHC.Runtime.Linker.html#showLS"><span class="hs-identifier hs-type">showLS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-type">LibrarySpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1219"></span><span id="showLS"><span class="annot"><span class="annottext">showLS :: LibrarySpec -&gt; String
</span><a href="GHC.Runtime.Linker.html#showLS"><span class="hs-identifier hs-var hs-var">showLS</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#Objects"><span class="hs-identifier hs-type">Objects</span></a></span><span> </span><span id="local-6989586621681179276"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179276"><span class="hs-identifier hs-var">nms</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(static) [&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; String
forall a. [a] -&gt; [[a]] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#intercalate"><span class="hs-identifier hs-var">intercalate</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;, &quot;</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179276"><span class="hs-identifier hs-var">nms</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;]&quot;</span></span><span>
</span><span id="line-1220"></span><span class="annot"><a href="GHC.Runtime.Linker.html#showLS"><span class="hs-identifier hs-var">showLS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#Archive"><span class="hs-identifier hs-type">Archive</span></a></span><span> </span><span id="local-6989586621681179275"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179275"><span class="hs-identifier hs-var">nm</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(static archive) &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179275"><span class="hs-identifier hs-var">nm</span></a></span><span>
</span><span id="line-1221"></span><span class="annot"><a href="GHC.Runtime.Linker.html#showLS"><span class="hs-identifier hs-var">showLS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#DLL"><span class="hs-identifier hs-type">DLL</span></a></span><span> </span><span id="local-6989586621681179274"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179274"><span class="hs-identifier hs-var">nm</span></a></span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(dynamic) &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179274"><span class="hs-identifier hs-var">nm</span></a></span><span>
</span><span id="line-1222"></span><span class="annot"><a href="GHC.Runtime.Linker.html#showLS"><span class="hs-identifier hs-var">showLS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#DLLPath"><span class="hs-identifier hs-type">DLLPath</span></a></span><span> </span><span id="local-6989586621681179273"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179273"><span class="hs-identifier hs-var">nm</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(dynamic) &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179273"><span class="hs-identifier hs-var">nm</span></a></span><span>
</span><span id="line-1223"></span><span class="annot"><a href="GHC.Runtime.Linker.html#showLS"><span class="hs-identifier hs-var">showLS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Linker.html#Framework"><span class="hs-identifier hs-type">Framework</span></a></span><span> </span><span id="local-6989586621681179272"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179272"><span class="hs-identifier hs-var">nm</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(framework) &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179272"><span class="hs-identifier hs-var">nm</span></a></span><span>
</span><span id="line-1224"></span><span>
</span><span id="line-1225"></span><span class="hs-comment">-- | Link exactly the specified packages, and their dependents (unless of</span><span>
</span><span id="line-1226"></span><span class="hs-comment">-- course they are already linked).  The dependents are linked</span><span>
</span><span id="line-1227"></span><span class="hs-comment">-- automatically, and it doesn't matter what order you specify the input</span><span>
</span><span id="line-1228"></span><span class="hs-comment">-- packages.</span><span>
</span><span id="line-1229"></span><span class="hs-comment">--</span><span>
</span><span id="line-1230"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkPackages"><span class="hs-identifier hs-type">linkPackages</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1231"></span><span class="hs-comment">-- NOTE: in fact, since each module tracks all the packages it depends on,</span><span>
</span><span id="line-1232"></span><span class="hs-comment">--       we don't really need to use the package-config dependencies.</span><span>
</span><span id="line-1233"></span><span class="hs-comment">--</span><span>
</span><span id="line-1234"></span><span class="hs-comment">-- However we do need the package-config stuff (to find aux libs etc),</span><span>
</span><span id="line-1235"></span><span class="hs-comment">-- and following them lets us load libraries in the right order, which</span><span>
</span><span id="line-1236"></span><span class="hs-comment">-- perhaps makes the error message a bit more localised if we get a link</span><span>
</span><span id="line-1237"></span><span class="hs-comment">-- failure.  So the dependency walking code is still here.</span><span>
</span><span id="line-1238"></span><span>
</span><span id="line-1239"></span><span id="linkPackages"><span class="annot"><span class="annottext">linkPackages :: HscEnv -&gt; [UnitId] -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#linkPackages"><span class="hs-identifier hs-var hs-var">linkPackages</span></a></span></span><span> </span><span id="local-6989586621681179271"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179271"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179270"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179270"><span class="hs-identifier hs-var">new_pkgs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1240"></span><span>  </span><span class="hs-comment">-- It's probably not safe to try to load packages concurrently, so we take</span><span>
</span><span id="line-1241"></span><span>  </span><span class="hs-comment">-- a lock.</span><span>
</span><span id="line-1242"></span><span>  </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#initDynLinker"><span class="hs-identifier hs-var">initDynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179271"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1243"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179269"><span class="annot"><span class="annottext">dl :: DynLinker
</span><a href="#local-6989586621681179269"><span class="hs-identifier hs-var hs-var">dl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynLinker
</span><a href="GHC.Driver.Types.html#hsc_dynLinker"><span class="hs-identifier hs-var hs-var">hsc_dynLinker</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179271"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1244"></span><span>  </span><span class="annot"><span class="annottext">DynLinker
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#modifyPLS_"><span class="hs-identifier hs-var">modifyPLS_</span></a></span><span> </span><span class="annot"><span class="annottext">DynLinker
</span><a href="#local-6989586621681179269"><span class="hs-identifier hs-var">dl</span></a></span><span> </span><span class="annot"><span class="annottext">((PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ())
-&gt; (PersistentLinkerState -&gt; IO PersistentLinkerState) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681179268"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179268"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1245"></span><span>    </span><span class="annot"><span class="annottext">HscEnv
-&gt; [UnitId] -&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#linkPackages%27"><span class="hs-identifier hs-var">linkPackages'</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179271"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179270"><span class="hs-identifier hs-var">new_pkgs</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179268"><span class="hs-identifier hs-var">pls</span></a></span><span>
</span><span id="line-1246"></span><span>
</span><span id="line-1247"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkPackages%27"><span class="hs-identifier hs-type">linkPackages'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-1248"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.Types.html#PersistentLinkerState"><span class="hs-identifier hs-type">PersistentLinkerState</span></a></span><span>
</span><span id="line-1249"></span><span id="linkPackages%27"><span class="annot"><span class="annottext">linkPackages' :: HscEnv
-&gt; [UnitId] -&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
</span><a href="GHC.Runtime.Linker.html#linkPackages%27"><span class="hs-identifier hs-var hs-var">linkPackages'</span></a></span></span><span> </span><span id="local-6989586621681179267"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179267"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179266"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179266"><span class="hs-identifier hs-var">new_pks</span></a></span></span><span> </span><span id="local-6989586621681179265"><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179265"><span class="hs-identifier hs-var">pls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1250"></span><span>    </span><span id="local-6989586621681179264"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179264"><span class="hs-identifier hs-var">pkgs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[UnitId] -&gt; [UnitId] -&gt; IO [UnitId]
</span><a href="#local-6989586621681179263"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; [UnitId]
</span><a href="GHC.Runtime.Linker.Types.html#pkgs_loaded"><span class="hs-identifier hs-var hs-var">pkgs_loaded</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179265"><span class="hs-identifier hs-var">pls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179266"><span class="hs-identifier hs-var">new_pks</span></a></span><span>
</span><span id="line-1251"></span><span>    </span><span class="annot"><span class="annottext">PersistentLinkerState -&gt; IO PersistentLinkerState
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(PersistentLinkerState -&gt; IO PersistentLinkerState)
-&gt; PersistentLinkerState -&gt; IO PersistentLinkerState
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">PersistentLinkerState
</span><a href="#local-6989586621681179265"><span class="hs-identifier hs-var">pls</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pkgs_loaded :: [UnitId]
</span><a href="GHC.Runtime.Linker.Types.html#pkgs_loaded"><span class="hs-identifier hs-var">pkgs_loaded</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179264"><span class="hs-identifier hs-var">pkgs'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1252"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1253"></span><span>     </span><span id="local-6989586621681179262"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681179262"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179267"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1254"></span><span>     </span><span id="local-6989586621681179261"><span class="annot"><span class="annottext">pkgstate :: UnitState
</span><a href="#local-6989586621681179261"><span class="hs-identifier hs-var hs-var">pkgstate</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; UnitState
</span><a href="GHC.Driver.Session.html#unitState"><span class="hs-identifier hs-var hs-var">unitState</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179262"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1255"></span><span>
</span><span id="line-1256"></span><span>     </span><span class="annot"><a href="#local-6989586621681179263"><span class="hs-identifier hs-type">link</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#UnitId"><span class="hs-identifier hs-type">UnitId</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1257"></span><span>     </span><span id="local-6989586621681179263"><span class="annot"><span class="annottext">link :: [UnitId] -&gt; [UnitId] -&gt; IO [UnitId]
</span><a href="#local-6989586621681179263"><span class="hs-identifier hs-var hs-var">link</span></a></span></span><span> </span><span id="local-6989586621681179260"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179260"><span class="hs-identifier hs-var">pkgs</span></a></span></span><span> </span><span id="local-6989586621681179259"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179259"><span class="hs-identifier hs-var">new_pkgs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1258"></span><span>         </span><span class="annot"><span class="annottext">([UnitId] -&gt; UnitId -&gt; IO [UnitId])
-&gt; [UnitId] -&gt; [UnitId] -&gt; IO [UnitId]
forall (t :: * -&gt; *) (m :: * -&gt; *) b a.
(Foldable t, Monad m) =&gt;
(b -&gt; a -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Control.Monad.html#foldM"><span class="hs-identifier hs-var">foldM</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId] -&gt; UnitId -&gt; IO [UnitId]
</span><a href="#local-6989586621681179258"><span class="hs-identifier hs-var">link_one</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179260"><span class="hs-identifier hs-var">pkgs</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179259"><span class="hs-identifier hs-var">new_pkgs</span></a></span><span>
</span><span id="line-1259"></span><span>
</span><span id="line-1260"></span><span>     </span><span id="local-6989586621681179258"><span class="annot"><span class="annottext">link_one :: [UnitId] -&gt; UnitId -&gt; IO [UnitId]
</span><a href="#local-6989586621681179258"><span class="hs-identifier hs-var hs-var">link_one</span></a></span></span><span> </span><span id="local-6989586621681179250"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179250"><span class="hs-identifier hs-var">pkgs</span></a></span></span><span> </span><span id="local-6989586621681179249"><span class="annot"><span class="annottext">UnitId
</span><a href="#local-6989586621681179249"><span class="hs-identifier hs-var">new_pkg</span></a></span></span><span>
</span><span id="line-1261"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">UnitId
</span><a href="#local-6989586621681179249"><span class="hs-identifier hs-var">new_pkg</span></a></span><span> </span><span class="annot"><span class="annottext">UnitId -&gt; [UnitId] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179250"><span class="hs-identifier hs-var">pkgs</span></a></span><span>   </span><span class="hs-comment">-- Already linked</span><span>
</span><span id="line-1262"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[UnitId] -&gt; IO [UnitId]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179250"><span class="hs-identifier hs-var">pkgs</span></a></span><span>
</span><span id="line-1263"></span><span>
</span><span id="line-1264"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179248"><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179248"><span class="hs-identifier hs-var">pkg_cfg</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UnitState -&gt; UnitId -&gt; Maybe UnitInfo
</span><a href="GHC.Unit.State.html#lookupUnitId"><span class="hs-identifier hs-var">lookupUnitId</span></a></span><span> </span><span class="annot"><span class="annottext">UnitState
</span><a href="#local-6989586621681179261"><span class="hs-identifier hs-var">pkgstate</span></a></span><span> </span><span class="annot"><span class="annottext">UnitId
</span><a href="#local-6989586621681179249"><span class="hs-identifier hs-var">new_pkg</span></a></span><span>
</span><span id="line-1265"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span>  </span><span class="hs-comment">-- Link dependents first</span><span>
</span><span id="line-1266"></span><span>               </span><span id="local-6989586621681179246"><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179246"><span class="hs-identifier hs-var">pkgs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[UnitId] -&gt; [UnitId] -&gt; IO [UnitId]
</span><a href="#local-6989586621681179263"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179250"><span class="hs-identifier hs-var">pkgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnitInfo -&gt; [UnitId]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [uid]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitDepends"><span class="hs-identifier hs-var hs-var">unitDepends</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179248"><span class="hs-identifier hs-var">pkg_cfg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1267"></span><span>                </span><span class="hs-comment">-- Now link the package itself</span><span>
</span><span id="line-1268"></span><span>             </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; UnitInfo -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#linkPackage"><span class="hs-identifier hs-var">linkPackage</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179267"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179248"><span class="hs-identifier hs-var">pkg_cfg</span></a></span><span>
</span><span id="line-1269"></span><span>             </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[UnitId] -&gt; IO [UnitId]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnitId
</span><a href="#local-6989586621681179249"><span class="hs-identifier hs-var">new_pkg</span></a></span><span> </span><span class="annot"><span class="annottext">UnitId -&gt; [UnitId] -&gt; [UnitId]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[UnitId]
</span><a href="#local-6989586621681179246"><span class="hs-identifier hs-var">pkgs'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1270"></span><span>
</span><span id="line-1271"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1272"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO [UnitId]
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#CmdLineError"><span class="hs-identifier hs-var">CmdLineError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unknown package: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; String
</span><a href="GHC.Data.FastString.html#unpackFS"><span class="hs-identifier hs-var">unpackFS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnitId -&gt; FastString
</span><a href="GHC.Unit.Types.html#unitIdFS"><span class="hs-identifier hs-var hs-var">unitIdFS</span></a></span><span> </span><span class="annot"><span class="annottext">UnitId
</span><a href="#local-6989586621681179249"><span class="hs-identifier hs-var">new_pkg</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1273"></span><span>
</span><span id="line-1274"></span><span>
</span><span id="line-1275"></span><span class="annot"><a href="GHC.Runtime.Linker.html#linkPackage"><span class="hs-identifier hs-type">linkPackage</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Info.html#UnitInfo"><span class="hs-identifier hs-type">UnitInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1276"></span><span id="linkPackage"><span class="annot"><span class="annottext">linkPackage :: HscEnv -&gt; UnitInfo -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#linkPackage"><span class="hs-identifier hs-var hs-var">linkPackage</span></a></span></span><span> </span><span id="local-6989586621681179242"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179241"><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span></span><span>
</span><span id="line-1277"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1278"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179240"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681179240"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1279"></span><span>            </span><span id="local-6989586621681179239"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681179239"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179240"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1280"></span><span>            </span><span id="local-6989586621681179238"><span class="annot"><span class="annottext">is_dyn :: Bool
</span><a href="#local-6989586621681179238"><span class="hs-identifier hs-var hs-var">is_dyn</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Interp -&gt; Bool
</span><a href="GHC.Runtime.Interpreter.html#interpreterDynamic"><span class="hs-identifier hs-var">interpreterDynamic</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; Interp
</span><a href="GHC.Runtime.Interpreter.html#hscInterp"><span class="hs-identifier hs-var">hscInterp</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1281"></span><span>            </span><span id="local-6989586621681179237"><span class="annot"><span class="annottext">dirs :: [String]
</span><a href="#local-6989586621681179237"><span class="hs-identifier hs-var hs-var">dirs</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179238"><span class="hs-identifier hs-var">is_dyn</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnitInfo -&gt; [String]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [String]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitLibraryDynDirs"><span class="hs-identifier hs-var hs-var">Packages.unitLibraryDynDirs</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span>
</span><span id="line-1282"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnitInfo -&gt; [String]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [String]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitLibraryDirs"><span class="hs-identifier hs-var hs-var">Packages.unitLibraryDirs</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span>
</span><span id="line-1283"></span><span>
</span><span id="line-1284"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179234"><span class="annot"><span class="annottext">hs_libs :: [String]
</span><a href="#local-6989586621681179234"><span class="hs-identifier hs-var hs-var">hs_libs</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">UnitInfo -&gt; [String]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [String]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitLibraries"><span class="hs-identifier hs-var hs-var">Packages.unitLibraries</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span>
</span><span id="line-1285"></span><span>            </span><span class="hs-comment">-- The FFI GHCi import lib isn't needed as</span><span>
</span><span id="line-1286"></span><span>            </span><span class="hs-comment">-- GHC.Runtime.Linker + rts/Linker.c link the</span><span>
</span><span id="line-1287"></span><span>            </span><span class="hs-comment">-- interpreted references to FFI to the compiled FFI.</span><span>
</span><span id="line-1288"></span><span>            </span><span class="hs-comment">-- We therefore filter it out so that we don't get</span><span>
</span><span id="line-1289"></span><span>            </span><span class="hs-comment">-- duplicate symbol errors.</span><span>
</span><span id="line-1290"></span><span>            </span><span id="local-6989586621681179230"><span class="annot"><span class="annottext">hs_libs' :: [String]
</span><a href="#local-6989586621681179230"><span class="hs-identifier hs-var hs-var">hs_libs'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(String -&gt; Bool) -&gt; [String] -&gt; [String]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;HSffi&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179234"><span class="hs-identifier hs-var">hs_libs</span></a></span><span>
</span><span id="line-1291"></span><span>
</span><span id="line-1292"></span><span>        </span><span class="hs-comment">-- Because of slight differences between the GHC dynamic linker and</span><span>
</span><span id="line-1293"></span><span>        </span><span class="hs-comment">-- the native system linker some packages have to link with a</span><span>
</span><span id="line-1294"></span><span>        </span><span class="hs-comment">-- different list of libraries when using GHCi. Examples include: libs</span><span>
</span><span id="line-1295"></span><span>        </span><span class="hs-comment">-- that are actually gnu ld scripts, and the possibility that the .a</span><span>
</span><span id="line-1296"></span><span>        </span><span class="hs-comment">-- libs do not exactly match the .so/.dll equivalents. So if the</span><span>
</span><span id="line-1297"></span><span>        </span><span class="hs-comment">-- package file provides an &quot;extra-ghci-libraries&quot; field then we use</span><span>
</span><span id="line-1298"></span><span>        </span><span class="hs-comment">-- that instead of the &quot;extra-libraries&quot; field.</span><span>
</span><span id="line-1299"></span><span>            </span><span id="local-6989586621681179228"><span class="annot"><span class="annottext">extra_libs :: [String]
</span><a href="#local-6989586621681179228"><span class="hs-identifier hs-var hs-var">extra_libs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1300"></span><span>                      </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnitInfo -&gt; [String]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [String]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitExtDepLibsGhc"><span class="hs-identifier hs-var hs-var">Packages.unitExtDepLibsGhc</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1301"></span><span>                            </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">UnitInfo -&gt; [String]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [String]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitExtDepLibsSys"><span class="hs-identifier hs-var hs-var">Packages.unitExtDepLibsSys</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span>
</span><span id="line-1302"></span><span>                            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">UnitInfo -&gt; [String]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [String]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitExtDepLibsGhc"><span class="hs-identifier hs-var hs-var">Packages.unitExtDepLibsGhc</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1303"></span><span>                      </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179225"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'l'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179225"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179225"><span class="hs-identifier hs-var">lib</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UnitInfo -&gt; [String]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [String]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitLinkerOptions"><span class="hs-identifier hs-var hs-var">Packages.unitLinkerOptions</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1304"></span><span>        </span><span class="hs-comment">-- See Note [Fork/Exec Windows]</span><span>
</span><span id="line-1305"></span><span>        </span><span id="local-6989586621681179223"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179223"><span class="hs-identifier hs-var">gcc_paths</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; OS -&gt; IO [String]
</span><a href="GHC.Runtime.Linker.html#getGCCPaths"><span class="hs-identifier hs-var">getGCCPaths</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179240"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformOS"><span class="hs-identifier hs-var">platformOS</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179239"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1306"></span><span>        </span><span id="local-6989586621681179222"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179222"><span class="hs-identifier hs-var">dirs_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; IO [String]
</span><a href="GHC.Runtime.Linker.html#addEnvPaths"><span class="hs-identifier hs-var">addEnvPaths</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;LIBRARY_PATH&quot;</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179237"><span class="hs-identifier hs-var">dirs</span></a></span><span>
</span><span id="line-1307"></span><span>
</span><span id="line-1308"></span><span>        </span><span id="local-6989586621681179221"><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179221"><span class="hs-identifier hs-var">hs_classifieds</span></a></span></span><span>
</span><span id="line-1309"></span><span>           </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO LibrarySpec) -&gt; [String] -&gt; IO [LibrarySpec]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; Bool -&gt; [String] -&gt; [String] -&gt; String -&gt; IO LibrarySpec
</span><a href="GHC.Runtime.Linker.html#locateLib"><span class="hs-identifier hs-var">locateLib</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>  </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179222"><span class="hs-identifier hs-var">dirs_env</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179223"><span class="hs-identifier hs-var">gcc_paths</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179230"><span class="hs-identifier hs-var">hs_libs'</span></a></span><span>
</span><span id="line-1310"></span><span>        </span><span id="local-6989586621681179220"><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179220"><span class="hs-identifier hs-var">extra_classifieds</span></a></span></span><span>
</span><span id="line-1311"></span><span>           </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO LibrarySpec) -&gt; [String] -&gt; IO [LibrarySpec]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; Bool -&gt; [String] -&gt; [String] -&gt; String -&gt; IO LibrarySpec
</span><a href="GHC.Runtime.Linker.html#locateLib"><span class="hs-identifier hs-var">locateLib</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179222"><span class="hs-identifier hs-var">dirs_env</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179223"><span class="hs-identifier hs-var">gcc_paths</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179228"><span class="hs-identifier hs-var">extra_libs</span></a></span><span>
</span><span id="line-1312"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179219"><span class="annot"><span class="annottext">classifieds :: [LibrarySpec]
</span><a href="#local-6989586621681179219"><span class="hs-identifier hs-var hs-var">classifieds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179221"><span class="hs-identifier hs-var">hs_classifieds</span></a></span><span> </span><span class="annot"><span class="annottext">[LibrarySpec] -&gt; [LibrarySpec] -&gt; [LibrarySpec]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179220"><span class="hs-identifier hs-var">extra_classifieds</span></a></span><span>
</span><span id="line-1313"></span><span>
</span><span id="line-1314"></span><span>        </span><span class="hs-comment">-- Complication: all the .so's must be loaded before any of the .o's.</span><span>
</span><span id="line-1315"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179218"><span class="annot"><span class="annottext">known_dlls :: [String]
</span><a href="#local-6989586621681179218"><span class="hs-identifier hs-var hs-var">known_dlls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179217"><span class="hs-identifier hs-var">dll</span></a></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#DLLPath"><span class="hs-identifier hs-type">DLLPath</span></a></span><span> </span><span id="local-6989586621681179217"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179217"><span class="hs-identifier hs-var">dll</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179219"><span class="hs-identifier hs-var">classifieds</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1316"></span><span>            </span><span id="local-6989586621681179216"><span class="annot"><span class="annottext">dlls :: [String]
</span><a href="#local-6989586621681179216"><span class="hs-identifier hs-var hs-var">dlls</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179215"><span class="hs-identifier hs-var">dll</span></a></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#DLL"><span class="hs-identifier hs-type">DLL</span></a></span><span> </span><span id="local-6989586621681179215"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179215"><span class="hs-identifier hs-var">dll</span></a></span></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179219"><span class="hs-identifier hs-var">classifieds</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1317"></span><span>            </span><span id="local-6989586621681179214"><span class="annot"><span class="annottext">objs :: [String]
</span><a href="#local-6989586621681179214"><span class="hs-identifier hs-var hs-var">objs</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179213"><span class="hs-identifier hs-var">obj</span></a></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#Objects"><span class="hs-identifier hs-type">Objects</span></a></span><span> </span><span id="local-6989586621681179212"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179212"><span class="hs-identifier hs-var">objs</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179219"><span class="hs-identifier hs-var">classifieds</span></a></span><span>
</span><span id="line-1318"></span><span>                                </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681179213"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179213"><span class="hs-identifier hs-var">obj</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179212"><span class="hs-identifier hs-var">objs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1319"></span><span>            </span><span id="local-6989586621681179211"><span class="annot"><span class="annottext">archs :: [String]
</span><a href="#local-6989586621681179211"><span class="hs-identifier hs-var hs-var">archs</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179210"><span class="hs-identifier hs-var">arch</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#Archive"><span class="hs-identifier hs-type">Archive</span></a></span><span> </span><span id="local-6989586621681179210"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179210"><span class="hs-identifier hs-var">arch</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LibrarySpec]
</span><a href="#local-6989586621681179219"><span class="hs-identifier hs-var">classifieds</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1320"></span><span>
</span><span id="line-1321"></span><span>        </span><span class="hs-comment">-- Add directories to library search paths</span><span>
</span><span id="line-1322"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179209"><span class="annot"><span class="annottext">dll_paths :: [String]
</span><a href="#local-6989586621681179209"><span class="hs-identifier hs-var hs-var">dll_paths</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#takeDirectory"><span class="hs-identifier hs-var">takeDirectory</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179218"><span class="hs-identifier hs-var">known_dlls</span></a></span><span>
</span><span id="line-1323"></span><span>            </span><span id="local-6989586621681179206"><span class="annot"><span class="annottext">all_paths :: [String]
</span><a href="#local-6989586621681179206"><span class="hs-identifier hs-var hs-var">all_paths</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String]
forall a. Eq a =&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#nub"><span class="hs-identifier hs-var">nub</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String]) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#normalise"><span class="hs-identifier hs-var">normalise</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String]) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179209"><span class="hs-identifier hs-var">dll_paths</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179237"><span class="hs-identifier hs-var">dirs</span></a></span><span>
</span><span id="line-1324"></span><span>        </span><span id="local-6989586621681179205"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179205"><span class="hs-identifier hs-var">all_paths_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; IO [String]
</span><a href="GHC.Runtime.Linker.html#addEnvPaths"><span class="hs-identifier hs-var">addEnvPaths</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;LD_LIBRARY_PATH&quot;</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179206"><span class="hs-identifier hs-var">all_paths</span></a></span><span>
</span><span id="line-1325"></span><span>        </span><span id="local-6989586621681179204"><span class="annot"><span class="annottext">[Ptr ()]
</span><a href="#local-6989586621681179204"><span class="hs-identifier hs-var">pathCache</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO (Ptr ())) -&gt; [String] -&gt; IO [Ptr ()]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO (Ptr ())
</span><a href="GHC.Runtime.Interpreter.html#addLibrarySearchPath"><span class="hs-identifier hs-var">addLibrarySearchPath</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179205"><span class="hs-identifier hs-var">all_paths_env</span></a></span><span>
</span><span id="line-1326"></span><span>
</span><span id="line-1327"></span><span>        </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStr"><span class="hs-identifier hs-var">maybePutStr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179240"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1328"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Loading package &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo -&gt; String
forall u. GenUnitInfo u -&gt; String
</span><a href="GHC.Unit.Info.html#unitPackageIdString"><span class="hs-identifier hs-var">unitPackageIdString</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; ... &quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1329"></span><span>
</span><span id="line-1330"></span><span>        </span><span class="hs-comment">-- See comments with partOfGHCi</span><span class="hs-cpp">
#if defined(CAN_LOAD_DLL)
</span><span>        </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnitInfo -&gt; PackageName
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; srcpkgname
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitPackageName"><span class="hs-identifier hs-var hs-var">unitPackageName</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span> </span><span class="annot"><span class="annottext">PackageName -&gt; [PackageName] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#notElem"><span class="hs-operator hs-var">`notElem`</span></a></span><span> </span><span class="annot"><span class="annottext">[PackageName]
</span><a href="GHC.Runtime.Linker.html#partOfGHCi"><span class="hs-identifier hs-var">partOfGHCi</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1333"></span><span>            </span><span class="annot"><span class="annottext">HscEnv -&gt; Platform -&gt; UnitInfo -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#loadFrameworks"><span class="hs-identifier hs-var">loadFrameworks</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179239"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span>
</span><span id="line-1334"></span><span>            </span><span class="hs-comment">-- See Note [Crash early load_dyn and locateLib]</span><span>
</span><span id="line-1335"></span><span>            </span><span class="hs-comment">-- Crash early if can't load any of `known_dlls`</span><span>
</span><span id="line-1336"></span><span>            </span><span class="annot"><span class="annottext">(String -&gt; IO ()) -&gt; [String] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; Bool -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#load_dyn"><span class="hs-identifier hs-var">load_dyn</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179218"><span class="hs-identifier hs-var">known_dlls</span></a></span><span>
</span><span id="line-1337"></span><span>            </span><span class="hs-comment">-- For remaining `dlls` crash early only when there is surely</span><span>
</span><span id="line-1338"></span><span>            </span><span class="hs-comment">-- no package's DLL around ... (not is_dyn)</span><span>
</span><span id="line-1339"></span><span>            </span><span class="annot"><span class="annottext">(String -&gt; IO ()) -&gt; [String] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; Bool -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#load_dyn"><span class="hs-identifier hs-var">load_dyn</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179238"><span class="hs-identifier hs-var">is_dyn</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO ()) -&gt; (String -&gt; String) -&gt; String -&gt; IO ()
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; String -&gt; String
</span><a href="GHC.Driver.Types.html#mkSOName"><span class="hs-identifier hs-var">mkSOName</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179239"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179216"><span class="hs-identifier hs-var">dlls</span></a></span><span class="hs-cpp">
#endif
</span><span>        </span><span class="hs-comment">-- After loading all the DLLs, we can load the static objects.</span><span>
</span><span id="line-1342"></span><span>        </span><span class="hs-comment">-- Ordering isn't important here, because we do one final link</span><span>
</span><span id="line-1343"></span><span>        </span><span class="hs-comment">-- step to resolve everything.</span><span>
</span><span id="line-1344"></span><span>        </span><span class="annot"><span class="annottext">(String -&gt; IO ()) -&gt; [String] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Interpreter.html#loadObj"><span class="hs-identifier hs-var">loadObj</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179214"><span class="hs-identifier hs-var">objs</span></a></span><span>
</span><span id="line-1345"></span><span>        </span><span class="annot"><span class="annottext">(String -&gt; IO ()) -&gt; [String] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Interpreter.html#loadArchive"><span class="hs-identifier hs-var">loadArchive</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179211"><span class="hs-identifier hs-var">archs</span></a></span><span>
</span><span id="line-1346"></span><span>
</span><span id="line-1347"></span><span>        </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStr"><span class="hs-identifier hs-var">maybePutStr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179240"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linking ... &quot;</span></span><span>
</span><span id="line-1348"></span><span>        </span><span id="local-6989586621681179198"><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179198"><span class="hs-identifier hs-var">ok</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; IO SuccessFlag
</span><a href="GHC.Runtime.Interpreter.html#resolveObjs"><span class="hs-identifier hs-var">resolveObjs</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1349"></span><span>
</span><span id="line-1350"></span><span>        </span><span class="hs-comment">-- DLLs are loaded, reset the search paths</span><span>
</span><span id="line-1351"></span><span>        </span><span class="hs-comment">-- Import libraries will be loaded via loadArchive so only</span><span>
</span><span id="line-1352"></span><span>        </span><span class="hs-comment">-- reset the DLL search path after all archives are loaded</span><span>
</span><span id="line-1353"></span><span>        </span><span class="hs-comment">-- as well.</span><span>
</span><span id="line-1354"></span><span>        </span><span class="annot"><span class="annottext">(Ptr () -&gt; IO Bool) -&gt; [Ptr ()] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; Ptr () -&gt; IO Bool
</span><a href="GHC.Runtime.Interpreter.html#removeLibrarySearchPath"><span class="hs-identifier hs-var">removeLibrarySearchPath</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179242"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([Ptr ()] -&gt; IO ()) -&gt; [Ptr ()] -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Ptr ()] -&gt; [Ptr ()]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Ptr ()]
</span><a href="#local-6989586621681179204"><span class="hs-identifier hs-var">pathCache</span></a></span><span>
</span><span id="line-1355"></span><span>
</span><span id="line-1356"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">SuccessFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#succeeded"><span class="hs-identifier hs-var">succeeded</span></a></span><span> </span><span class="annot"><span class="annottext">SuccessFlag
</span><a href="#local-6989586621681179198"><span class="hs-identifier hs-var">ok</span></a></span><span>
</span><span id="line-1357"></span><span>           </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var">maybePutStrLn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179240"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;done.&quot;</span></span><span>
</span><span id="line-1358"></span><span>           </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179197"><span class="annot"><span class="annottext">errmsg :: String
</span><a href="#local-6989586621681179197"><span class="hs-identifier hs-var hs-var">errmsg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unable to load package `&quot;</span></span><span>
</span><span id="line-1359"></span><span>                             </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo -&gt; String
forall u. GenUnitInfo u -&gt; String
</span><a href="GHC.Unit.Info.html#unitPackageIdString"><span class="hs-identifier hs-var">unitPackageIdString</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179241"><span class="hs-identifier hs-var">pkg</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;'&quot;</span></span><span>
</span><span id="line-1360"></span><span>                 </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO ()
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#InstallationError"><span class="hs-identifier hs-var">InstallationError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179197"><span class="hs-identifier hs-var">errmsg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1361"></span><span>
</span><span id="line-1362"></span><span class="hs-comment">{-
Note [Crash early load_dyn and locateLib]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If a package is &quot;normal&quot; (exposes it's code from more than zero Haskell
modules, unlike e.g. that in ghcilink004) and is built &quot;dyn&quot; way, then
it has it's code compiled and linked into the DLL, which GHCi linker picks
when loading the package's code (see the big comment in the beginning of
`locateLib`).

When loading DLLs, GHCi linker simply calls the system's `dlopen` or
`LoadLibrary` APIs. This is quite different from the case when GHCi linker
loads an object file or static library. When loading an object file or static
library GHCi linker parses them and resolves all symbols &quot;manually&quot;.
These object file or static library may reference some external symbols
defined in some external DLLs. And GHCi should know which these
external DLLs are.

But when GHCi loads a DLL, it's the *system* linker who manages all
the necessary dependencies, and it is able to load this DLL not having
any extra info. Thus we don't *have to* crash in this case even if we
are unable to load any supposed dependencies explicitly.

Suppose during GHCi session a client of the package wants to
`foreign import` a symbol which isn't exposed by the package DLL, but
is exposed by such an external (dependency) DLL.
If the DLL isn't *explicitly* loaded because `load_dyn` failed to do
this, then the client code eventually crashes because the GHCi linker
isn't able to locate this symbol (GHCi linker maintains a list of
explicitly loaded DLLs it looks into when trying to find a symbol).

This is why we still should try to load all the dependency DLLs
even though we know that the system linker loads them implicitly when
loading the package DLL.

Why we still keep the `crash_early` opportunity then not allowing such
a permissive behaviour for any DLLs? Well, we, perhaps, improve a user
experience in some cases slightly.

But if it happens there exist other corner cases where our current
usage of `crash_early` flag is overly restrictive, we may lift the
restriction very easily.
-}</span><span>
</span><span id="line-1404"></span><span>
</span><span id="line-1405"></span><span class="hs-comment">-- we have already searched the filesystem; the strings passed to load_dyn</span><span>
</span><span id="line-1406"></span><span class="hs-comment">-- can be passed directly to loadDLL.  They are either fully-qualified</span><span>
</span><span id="line-1407"></span><span class="hs-comment">-- (&quot;/usr/lib/libfoo.so&quot;), or unqualified (&quot;libfoo.so&quot;).  In the latter case,</span><span>
</span><span id="line-1408"></span><span class="hs-comment">-- loadDLL is going to search the system paths to find the library.</span><span>
</span><span id="line-1409"></span><span class="annot"><a href="GHC.Runtime.Linker.html#load_dyn"><span class="hs-identifier hs-type">load_dyn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1410"></span><span id="load_dyn"><span class="annot"><span class="annottext">load_dyn :: HscEnv -&gt; Bool -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#load_dyn"><span class="hs-identifier hs-var hs-var">load_dyn</span></a></span></span><span> </span><span id="local-6989586621681179195"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179195"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179194"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179194"><span class="hs-identifier hs-var">crash_early</span></a></span></span><span> </span><span id="local-6989586621681179193"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179193"><span class="hs-identifier hs-var">dll</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1411"></span><span>  </span><span id="local-6989586621681179192"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179192"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Interpreter.html#loadDLL"><span class="hs-identifier hs-var">loadDLL</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179195"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179193"><span class="hs-identifier hs-var">dll</span></a></span><span>
</span><span id="line-1412"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179192"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1413"></span><span>    </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1414"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179191"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179191"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1415"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179194"><span class="hs-identifier hs-var">crash_early</span></a></span><span>
</span><span id="line-1416"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO ()
forall a. String -&gt; IO a
</span><a href="GHC.Utils.Panic.Plain.html#cmdLineErrorIO"><span class="hs-identifier hs-var">cmdLineErrorIO</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179191"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-1417"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179189"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681179189"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179195"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-keyword">in</span><span>
</span><span id="line-1418"></span><span>          </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#wopt"><span class="hs-identifier hs-var">wopt</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissedExtraSharedLib"><span class="hs-identifier hs-var">Opt_WarnMissedExtraSharedLib</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179189"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1419"></span><span>            </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; WarnReason -&gt; Severity -&gt; SrcSpan -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Driver.Session.html#putLogMsg"><span class="hs-identifier hs-var">putLogMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179189"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1420"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissedExtraSharedLib"><span class="hs-identifier hs-var">Opt_WarnMissedExtraSharedLib</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Severity
</span><a href="GHC.Utils.Error.html#SevWarning"><span class="hs-identifier hs-var">SevWarning</span></a></span><span>
</span><span id="line-1421"></span><span>                  </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier hs-var">noSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO ()) -&gt; SDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#withPprStyle"><span class="hs-identifier hs-var">withPprStyle</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle
</span><a href="GHC.Utils.Outputable.html#defaultUserStyle"><span class="hs-identifier hs-var">defaultUserStyle</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="#local-6989586621681179184"><span class="hs-identifier hs-var">note</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179191"><span class="hs-identifier hs-var">err</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1422"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1423"></span><span>    </span><span id="local-6989586621681179184"><span class="annot"><span class="annottext">note :: String -&gt; SDoc
</span><a href="#local-6989586621681179184"><span class="hs-identifier hs-var hs-var">note</span></a></span></span><span> </span><span id="local-6989586621681179183"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179183"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="annot"><span class="annottext">([SDoc] -&gt; SDoc) -&gt; [SDoc] -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; SDoc) -&gt; [String] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span>
</span><span id="line-1424"></span><span>      </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179183"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-1425"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;It's OK if you don't want to use symbols from it directly.&quot;</span></span><span>
</span><span id="line-1426"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(the package DLL is loaded by the system linker&quot;</span></span><span>
</span><span id="line-1427"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; which manages dependencies by itself).&quot;</span></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1428"></span><span>
</span><span id="line-1429"></span><span class="annot"><a href="GHC.Runtime.Linker.html#loadFrameworks"><span class="hs-identifier hs-type">loadFrameworks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Info.html#UnitInfo"><span class="hs-identifier hs-type">UnitInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1430"></span><span id="loadFrameworks"><span class="annot"><span class="annottext">loadFrameworks :: HscEnv -&gt; Platform -&gt; UnitInfo -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#loadFrameworks"><span class="hs-identifier hs-var hs-var">loadFrameworks</span></a></span></span><span> </span><span id="local-6989586621681179182"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179182"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179181"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179181"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span id="local-6989586621681179180"><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179180"><span class="hs-identifier hs-var">pkg</span></a></span></span><span>
</span><span id="line-1431"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; Bool
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformUsesFrameworks"><span class="hs-identifier hs-var">platformUsesFrameworks</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179181"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO ()) -&gt; [String] -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; IO ()
</span><a href="#local-6989586621681179179"><span class="hs-identifier hs-var">load</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179178"><span class="hs-identifier hs-var">frameworks</span></a></span><span>
</span><span id="line-1432"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1433"></span><span>    </span><span id="local-6989586621681179177"><span class="annot"><span class="annottext">fw_dirs :: [String]
</span><a href="#local-6989586621681179177"><span class="hs-identifier hs-var hs-var">fw_dirs</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnitInfo -&gt; [String]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [String]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitExtDepFrameworkDirs"><span class="hs-identifier hs-var hs-var">Packages.unitExtDepFrameworkDirs</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179180"><span class="hs-identifier hs-var">pkg</span></a></span><span>
</span><span id="line-1434"></span><span>    </span><span id="local-6989586621681179178"><span class="annot"><span class="annottext">frameworks :: [String]
</span><a href="#local-6989586621681179178"><span class="hs-identifier hs-var hs-var">frameworks</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnitInfo -&gt; [String]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [String]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitExtDepFrameworks"><span class="hs-identifier hs-var hs-var">Packages.unitExtDepFrameworks</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681179180"><span class="hs-identifier hs-var">pkg</span></a></span><span>
</span><span id="line-1435"></span><span>
</span><span id="line-1436"></span><span>    </span><span id="local-6989586621681179179"><span class="annot"><span class="annottext">load :: String -&gt; IO ()
</span><a href="#local-6989586621681179179"><span class="hs-identifier hs-var hs-var">load</span></a></span></span><span> </span><span id="local-6989586621681179172"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179172"><span class="hs-identifier hs-var">fw</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span id="local-6989586621681179171"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179171"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; [String] -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Linker.html#loadFramework"><span class="hs-identifier hs-var">loadFramework</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179182"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179177"><span class="hs-identifier hs-var">fw_dirs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179172"><span class="hs-identifier hs-var">fw</span></a></span><span>
</span><span id="line-1437"></span><span>                  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179171"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1438"></span><span>                    </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1439"></span><span>                    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179170"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179170"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO ()
forall a. String -&gt; IO a
</span><a href="GHC.Utils.Panic.Plain.html#cmdLineErrorIO"><span class="hs-identifier hs-var">cmdLineErrorIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;can't load framework: &quot;</span></span><span>
</span><span id="line-1440"></span><span>                                                </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179172"><span class="hs-identifier hs-var">fw</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; (&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179170"><span class="hs-identifier hs-var">err</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;)&quot;</span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1441"></span><span>
</span><span id="line-1442"></span><span class="hs-comment">-- Try to find an object file for a given library in the given paths.</span><span>
</span><span id="line-1443"></span><span class="hs-comment">-- If it isn't present, we assume that addDLL in the RTS can find it,</span><span>
</span><span id="line-1444"></span><span class="hs-comment">-- which generally means that it should be a dynamic library in the</span><span>
</span><span id="line-1445"></span><span class="hs-comment">-- standard system search path.</span><span>
</span><span id="line-1446"></span><span class="hs-comment">-- For GHCi we tend to prefer dynamic libraries over static ones as</span><span>
</span><span id="line-1447"></span><span class="hs-comment">-- they are easier to load and manage, have less overhead.</span><span>
</span><span id="line-1448"></span><span class="annot"><a href="GHC.Runtime.Linker.html#locateLib"><span class="hs-identifier hs-type">locateLib</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1449"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#LibrarySpec"><span class="hs-identifier hs-type">LibrarySpec</span></a></span><span>
</span><span id="line-1450"></span><span id="locateLib"><span class="annot"><span class="annottext">locateLib :: HscEnv -&gt; Bool -&gt; [String] -&gt; [String] -&gt; String -&gt; IO LibrarySpec
</span><a href="GHC.Runtime.Linker.html#locateLib"><span class="hs-identifier hs-var hs-var">locateLib</span></a></span></span><span> </span><span id="local-6989586621681179169"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179169"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179168"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179168"><span class="hs-identifier hs-var">is_hs</span></a></span></span><span> </span><span id="local-6989586621681179167"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179167"><span class="hs-identifier hs-var">lib_dirs</span></a></span></span><span> </span><span id="local-6989586621681179166"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179166"><span class="hs-identifier hs-var">gcc_dirs</span></a></span></span><span> </span><span id="local-6989586621681179165"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span></span><span>
</span><span id="line-1451"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179168"><span class="hs-identifier hs-var">is_hs</span></a></span><span>
</span><span id="line-1452"></span><span>    </span><span class="hs-comment">-- For non-Haskell libraries (e.g. gmp, iconv):</span><span>
</span><span id="line-1453"></span><span>    </span><span class="hs-comment">--   first look in library-dirs for a dynamic library (on User paths only)</span><span>
</span><span id="line-1454"></span><span>    </span><span class="hs-comment">--   (libfoo.so)</span><span>
</span><span id="line-1455"></span><span>    </span><span class="hs-comment">--   then  try looking for import libraries on Windows (on User paths only)</span><span>
</span><span id="line-1456"></span><span>    </span><span class="hs-comment">--   (.dll.a, .lib)</span><span>
</span><span id="line-1457"></span><span>    </span><span class="hs-comment">--   first look in library-dirs for a dynamic library (on GCC paths only)</span><span>
</span><span id="line-1458"></span><span>    </span><span class="hs-comment">--   (libfoo.so)</span><span>
</span><span id="line-1459"></span><span>    </span><span class="hs-comment">--   then  check for system dynamic libraries (e.g. kernel32.dll on windows)</span><span>
</span><span id="line-1460"></span><span>    </span><span class="hs-comment">--   then  try looking for import libraries on Windows (on GCC paths only)</span><span>
</span><span id="line-1461"></span><span>    </span><span class="hs-comment">--   (.dll.a, .lib)</span><span>
</span><span id="line-1462"></span><span>    </span><span class="hs-comment">--   then  look in library-dirs for a static library (libfoo.a)</span><span>
</span><span id="line-1463"></span><span>    </span><span class="hs-comment">--   then look in library-dirs and inplace GCC for a dynamic library (libfoo.so)</span><span>
</span><span id="line-1464"></span><span>    </span><span class="hs-comment">--   then  try looking for import libraries on Windows (.dll.a, .lib)</span><span>
</span><span id="line-1465"></span><span>    </span><span class="hs-comment">--   then  look in library-dirs and inplace GCC for a static library (libfoo.a)</span><span>
</span><span id="line-1466"></span><span>    </span><span class="hs-comment">--   then  try &quot;gcc --print-file-name&quot; to search gcc's search path</span><span>
</span><span id="line-1467"></span><span>    </span><span class="hs-comment">--       for a dynamic library (#5289)</span><span>
</span><span id="line-1468"></span><span>    </span><span class="hs-comment">--   otherwise, assume loadDLL can find it</span><span>
</span><span id="line-1469"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-1470"></span><span>    </span><span class="hs-comment">--   The logic is a bit complicated, but the rationale behind it is that</span><span>
</span><span id="line-1471"></span><span>    </span><span class="hs-comment">--   loading a shared library for us is O(1) while loading an archive is</span><span>
</span><span id="line-1472"></span><span>    </span><span class="hs-comment">--   O(n). Loading an import library is also O(n) so in general we prefer</span><span>
</span><span id="line-1473"></span><span>    </span><span class="hs-comment">--   shared libraries because they are simpler and faster.</span><span>
</span><span id="line-1474"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-1475"></span><span>  </span><span class="hs-glyph">=</span><span class="hs-cpp">
#if defined(CAN_LOAD_DLL)
</span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179164"><span class="hs-identifier hs-var">findDll</span></a></span><span>   </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179163"><span class="hs-identifier hs-var">user</span></a></span><span> </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span class="hs-cpp">
#endif
</span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179161"><span class="hs-identifier hs-var">tryImpLib</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179163"><span class="hs-identifier hs-var">user</span></a></span><span> </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span class="hs-cpp">
#if defined(CAN_LOAD_DLL)
</span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179164"><span class="hs-identifier hs-var">findDll</span></a></span><span>   </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179160"><span class="hs-identifier hs-var">gcc</span></a></span><span>  </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span>
</span><span id="line-1482"></span><span>    </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179159"><span class="hs-identifier hs-var">findSysDll</span></a></span><span>     </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span class="hs-cpp">
#endif
</span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179161"><span class="hs-identifier hs-var">tryImpLib</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179160"><span class="hs-identifier hs-var">gcc</span></a></span><span>  </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span>
</span><span id="line-1485"></span><span>    </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179158"><span class="hs-identifier hs-var">findArchive</span></a></span><span>    </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span>
</span><span id="line-1486"></span><span>    </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179157"><span class="hs-identifier hs-var">tryGcc</span></a></span><span>         </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span>
</span><span id="line-1487"></span><span>    </span><span class="annot"><span class="annottext">IO LibrarySpec
</span><a href="#local-6989586621681179156"><span class="hs-identifier hs-var">assumeDll</span></a></span><span>
</span><span id="line-1488"></span><span>
</span><span id="line-1489"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179155"><span class="hs-identifier hs-var">loading_dynamic_hs_libs</span></a></span><span> </span><span class="hs-comment">-- search for .so libraries first.</span><span>
</span><span id="line-1490"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179154"><span class="hs-identifier hs-var">findHSDll</span></a></span><span>     </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span>
</span><span id="line-1491"></span><span>    </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179153"><span class="hs-identifier hs-var">findDynObject</span></a></span><span> </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span>
</span><span id="line-1492"></span><span>    </span><span class="annot"><span class="annottext">IO LibrarySpec
</span><a href="#local-6989586621681179156"><span class="hs-identifier hs-var">assumeDll</span></a></span><span>
</span><span id="line-1493"></span><span>
</span><span id="line-1494"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1495"></span><span>    </span><span class="hs-comment">-- use HSfoo.{o,p_o} if it exists, otherwise fallback to libHSfoo{,_p}.a</span><span>
</span><span id="line-1496"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179152"><span class="hs-identifier hs-var">findObject</span></a></span><span>  </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span>
</span><span id="line-1497"></span><span>    </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179158"><span class="hs-identifier hs-var">findArchive</span></a></span><span> </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec) -&gt; IO LibrarySpec -&gt; IO LibrarySpec
forall {m :: * -&gt; *} {b}. Monad m =&gt; m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var">`orElse`</span></a></span><span>
</span><span id="line-1498"></span><span>    </span><span class="annot"><span class="annottext">IO LibrarySpec
</span><a href="#local-6989586621681179156"><span class="hs-identifier hs-var">assumeDll</span></a></span><span>
</span><span id="line-1499"></span><span>
</span><span id="line-1500"></span><span>   </span><span class="hs-keyword">where</span><span>
</span><span id="line-1501"></span><span>     </span><span id="local-6989586621681179151"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681179151"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179169"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1502"></span><span>     </span><span id="local-6989586621681179150"><span class="annot"><span class="annottext">interp :: Interp
</span><a href="#local-6989586621681179150"><span class="hs-identifier hs-var hs-var">interp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Interp
</span><a href="GHC.Runtime.Interpreter.html#hscInterp"><span class="hs-identifier hs-var">hscInterp</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179169"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-1503"></span><span>     </span><span id="local-6989586621681179149"><span class="annot"><span class="annottext">dirs :: [String]
</span><a href="#local-6989586621681179149"><span class="hs-identifier hs-var hs-var">dirs</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179167"><span class="hs-identifier hs-var">lib_dirs</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179166"><span class="hs-identifier hs-var">gcc_dirs</span></a></span><span>
</span><span id="line-1504"></span><span>     </span><span id="local-6989586621681179160"><span class="annot"><span class="annottext">gcc :: Bool
</span><a href="#local-6989586621681179160"><span class="hs-identifier hs-var hs-var">gcc</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1505"></span><span>     </span><span id="local-6989586621681179163"><span class="annot"><span class="annottext">user :: Bool
</span><a href="#local-6989586621681179163"><span class="hs-identifier hs-var hs-var">user</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1506"></span><span>
</span><span id="line-1507"></span><span>     </span><span id="local-6989586621681179148"><span class="annot"><span class="annottext">obj_file :: String
</span><a href="#local-6989586621681179148"><span class="hs-identifier hs-var hs-var">obj_file</span></a></span></span><span>
</span><span id="line-1508"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179168"><span class="hs-identifier hs-var">is_hs</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179147"><span class="hs-identifier hs-var">loading_profiled_hs_libs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;p_o&quot;</span></span><span>
</span><span id="line-1509"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;o&quot;</span></span><span>
</span><span id="line-1510"></span><span>     </span><span id="local-6989586621681179146"><span class="annot"><span class="annottext">dyn_obj_file :: String
</span><a href="#local-6989586621681179146"><span class="hs-identifier hs-var hs-var">dyn_obj_file</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;dyn_o&quot;</span></span><span>
</span><span id="line-1511"></span><span>     </span><span id="local-6989586621681179145"><span class="annot"><span class="annottext">arch_files :: [String]
</span><a href="#local-6989586621681179145"><span class="hs-identifier hs-var hs-var">arch_files</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;lib&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179144"><span class="hs-identifier hs-var">lib_tag</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;a&quot;</span></span><span>
</span><span id="line-1512"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;a&quot;</span></span><span> </span><span class="hs-comment">-- native code has no lib_tag</span><span>
</span><span id="line-1513"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;lib&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span>
</span><span id="line-1514"></span><span>                  </span><span class="hs-special">]</span><span>
</span><span id="line-1515"></span><span>     </span><span id="local-6989586621681179144"><span class="annot"><span class="annottext">lib_tag :: String
</span><a href="#local-6989586621681179144"><span class="hs-identifier hs-var hs-var">lib_tag</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179168"><span class="hs-identifier hs-var">is_hs</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179147"><span class="hs-identifier hs-var">loading_profiled_hs_libs</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;_p&quot;</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-1516"></span><span>
</span><span id="line-1517"></span><span>     </span><span id="local-6989586621681179147"><span class="annot"><span class="annottext">loading_profiled_hs_libs :: Bool
</span><a href="#local-6989586621681179147"><span class="hs-identifier hs-var hs-var">loading_profiled_hs_libs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Interp -&gt; Bool
</span><a href="GHC.Runtime.Interpreter.html#interpreterProfiled"><span class="hs-identifier hs-var">interpreterProfiled</span></a></span><span> </span><span class="annot"><span class="annottext">Interp
</span><a href="#local-6989586621681179150"><span class="hs-identifier hs-var">interp</span></a></span><span>
</span><span id="line-1518"></span><span>     </span><span id="local-6989586621681179155"><span class="annot"><span class="annottext">loading_dynamic_hs_libs :: Bool
</span><a href="#local-6989586621681179155"><span class="hs-identifier hs-var hs-var">loading_dynamic_hs_libs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Interp -&gt; Bool
</span><a href="GHC.Runtime.Interpreter.html#interpreterDynamic"><span class="hs-identifier hs-var">interpreterDynamic</span></a></span><span>  </span><span class="annot"><span class="annottext">Interp
</span><a href="#local-6989586621681179150"><span class="hs-identifier hs-var">interp</span></a></span><span>
</span><span id="line-1519"></span><span>
</span><span id="line-1520"></span><span>     </span><span id="local-6989586621681179142"><span class="annot"><span class="annottext">import_libs :: [String]
</span><a href="#local-6989586621681179142"><span class="hs-identifier hs-var hs-var">import_libs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;lib&quot;</span></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;lib&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;lib&quot;</span></span><span>
</span><span id="line-1521"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;lib&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;dll.a&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;dll.a&quot;</span></span><span>
</span><span id="line-1522"></span><span>                    </span><span class="hs-special">]</span><span>
</span><span id="line-1523"></span><span>
</span><span id="line-1524"></span><span>     </span><span id="local-6989586621681179141"><span class="annot"><span class="annottext">hs_dyn_lib_name :: String
</span><a href="#local-6989586621681179141"><span class="hs-identifier hs-var hs-var">hs_dyn_lib_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">DynFlags -&gt; String
</span><a href="GHC.Driver.Session.html#programName"><span class="hs-identifier hs-var">programName</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179151"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String
</span><a href="GHC.Driver.Session.html#projectVersion"><span class="hs-identifier hs-var">projectVersion</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179151"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1525"></span><span>     </span><span id="local-6989586621681179138"><span class="annot"><span class="annottext">hs_dyn_lib_file :: String
</span><a href="#local-6989586621681179138"><span class="hs-identifier hs-var hs-var">hs_dyn_lib_file</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; String -&gt; String
</span><a href="GHC.Driver.Types.html#mkHsSOName"><span class="hs-identifier hs-var">mkHsSOName</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179136"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179141"><span class="hs-identifier hs-var">hs_dyn_lib_name</span></a></span><span>
</span><span id="line-1526"></span><span>
</span><span id="line-1527"></span><span>     </span><span id="local-6989586621681179135"><span class="annot"><span class="annottext">so_name :: String
</span><a href="#local-6989586621681179135"><span class="hs-identifier hs-var hs-var">so_name</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; String -&gt; String
</span><a href="GHC.Driver.Types.html#mkSOName"><span class="hs-identifier hs-var">mkSOName</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179136"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span>
</span><span id="line-1528"></span><span>     </span><span id="local-6989586621681179134"><span class="annot"><span class="annottext">lib_so_name :: String
</span><a href="#local-6989586621681179134"><span class="hs-identifier hs-var hs-var">lib_so_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;lib&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179135"><span class="hs-identifier hs-var">so_name</span></a></span><span>
</span><span id="line-1529"></span><span>     </span><span id="local-6989586621681179133"><span class="annot"><span class="annottext">dyn_lib_file :: String
</span><a href="#local-6989586621681179133"><span class="hs-identifier hs-var hs-var">dyn_lib_file</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Arch
</span><a href="#local-6989586621681179132"><span class="hs-identifier hs-var">arch</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="#local-6989586621681179131"><span class="hs-identifier hs-var">os</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1530"></span><span>                             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchX86_64"><span class="hs-identifier hs-var">ArchX86_64</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#OSSolaris2"><span class="hs-identifier hs-var">OSSolaris2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;64&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C%2F%3E"><span class="hs-operator hs-var">&lt;/&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179135"><span class="hs-identifier hs-var">so_name</span></a></span><span>
</span><span id="line-1531"></span><span>                             </span><span class="annot"><span class="annottext">(Arch, OS)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179135"><span class="hs-identifier hs-var">so_name</span></a></span><span>
</span><span id="line-1532"></span><span>
</span><span id="line-1533"></span><span>     </span><span id="local-6989586621681179152"><span class="annot"><span class="annottext">findObject :: IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179152"><span class="hs-identifier hs-var hs-var">findObject</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; Maybe LibrarySpec)
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">((String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec)
-&gt; (String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#Objects"><span class="hs-identifier hs-var">Objects</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; LibrarySpec)
-&gt; (String -&gt; [String]) -&gt; String -&gt; LibrarySpec
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">)</span><span>  </span><span class="annot"><span class="annottext">(IO (Maybe String) -&gt; IO (Maybe LibrarySpec))
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String -&gt; IO (Maybe String)
</span><a href="../../directory/src/System.Directory.html#findFile"><span class="hs-identifier hs-var">findFile</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179149"><span class="hs-identifier hs-var">dirs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179148"><span class="hs-identifier hs-var">obj_file</span></a></span><span>
</span><span id="line-1534"></span><span>     </span><span id="local-6989586621681179153"><span class="annot"><span class="annottext">findDynObject :: IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179153"><span class="hs-identifier hs-var hs-var">findDynObject</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; Maybe LibrarySpec)
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">((String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec)
-&gt; (String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#Objects"><span class="hs-identifier hs-var">Objects</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; LibrarySpec)
-&gt; (String -&gt; [String]) -&gt; String -&gt; LibrarySpec
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">)</span><span>  </span><span class="annot"><span class="annottext">(IO (Maybe String) -&gt; IO (Maybe LibrarySpec))
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String -&gt; IO (Maybe String)
</span><a href="../../directory/src/System.Directory.html#findFile"><span class="hs-identifier hs-var">findFile</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179149"><span class="hs-identifier hs-var">dirs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179146"><span class="hs-identifier hs-var">dyn_obj_file</span></a></span><span>
</span><span id="line-1535"></span><span>     </span><span id="local-6989586621681179158"><span class="annot"><span class="annottext">findArchive :: IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179158"><span class="hs-identifier hs-var hs-var">findArchive</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179119"><span class="annot"><span class="annottext">local :: String -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179119"><span class="hs-identifier hs-var hs-var">local</span></a></span></span><span> </span><span id="local-6989586621681179118"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179118"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; Maybe LibrarySpec)
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#Archive"><span class="hs-identifier hs-var">Archive</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO (Maybe String) -&gt; IO (Maybe LibrarySpec))
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String -&gt; IO (Maybe String)
</span><a href="../../directory/src/System.Directory.html#findFile"><span class="hs-identifier hs-var">findFile</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179149"><span class="hs-identifier hs-var">dirs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179118"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1536"></span><span>                     </span><span class="hs-keyword">in</span><span>  </span><span class="annot"><span class="annottext">[IO (Maybe LibrarySpec)] -&gt; IO (Maybe LibrarySpec)
forall a. [IO (Maybe a)] -&gt; IO (Maybe a)
</span><a href="#local-6989586621681179117"><span class="hs-identifier hs-var">apply</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; IO (Maybe LibrarySpec))
-&gt; [String] -&gt; [IO (Maybe LibrarySpec)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179119"><span class="hs-identifier hs-var">local</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179145"><span class="hs-identifier hs-var">arch_files</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1537"></span><span>     </span><span id="local-6989586621681179154"><span class="annot"><span class="annottext">findHSDll :: IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179154"><span class="hs-identifier hs-var hs-var">findHSDll</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; Maybe LibrarySpec)
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#DLLPath"><span class="hs-identifier hs-var">DLLPath</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO (Maybe String) -&gt; IO (Maybe LibrarySpec))
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String -&gt; IO (Maybe String)
</span><a href="../../directory/src/System.Directory.html#findFile"><span class="hs-identifier hs-var">findFile</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179149"><span class="hs-identifier hs-var">dirs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179138"><span class="hs-identifier hs-var">hs_dyn_lib_file</span></a></span><span>
</span><span id="line-1538"></span><span>     </span><span id="local-6989586621681179164"><span class="annot"><span class="annottext">findDll :: Bool -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179164"><span class="hs-identifier hs-var hs-var">findDll</span></a></span></span><span>    </span><span id="local-6989586621681179112"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179112"><span class="hs-identifier hs-var">re</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179109"><span class="annot"><span class="annottext">dirs' :: [String]
</span><a href="#local-6989586621681179109"><span class="hs-identifier hs-var hs-var">dirs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179112"><span class="hs-identifier hs-var">re</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179163"><span class="hs-identifier hs-var">user</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179167"><span class="hs-identifier hs-var">lib_dirs</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179166"><span class="hs-identifier hs-var">gcc_dirs</span></a></span><span>
</span><span id="line-1539"></span><span>                     </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; Maybe LibrarySpec)
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#DLLPath"><span class="hs-identifier hs-var">DLLPath</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO (Maybe String) -&gt; IO (Maybe LibrarySpec))
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String -&gt; IO (Maybe String)
</span><a href="../../directory/src/System.Directory.html#findFile"><span class="hs-identifier hs-var">findFile</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179109"><span class="hs-identifier hs-var">dirs'</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179133"><span class="hs-identifier hs-var">dyn_lib_file</span></a></span><span>
</span><span id="line-1540"></span><span>     </span><span id="local-6989586621681179159"><span class="annot"><span class="annottext">findSysDll :: IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179159"><span class="hs-identifier hs-var hs-var">findSysDll</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; Maybe LibrarySpec)
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">((String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec)
-&gt; (String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#DLL"><span class="hs-identifier hs-var">DLL</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec)
-&gt; (String -&gt; String) -&gt; String -&gt; LibrarySpec
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#dropExtension"><span class="hs-identifier hs-var">dropExtension</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; (String -&gt; String) -&gt; String -&gt; String
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#takeFileName"><span class="hs-identifier hs-var">takeFileName</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO (Maybe String) -&gt; IO (Maybe LibrarySpec))
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1541"></span><span>                        </span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Interpreter.html#findSystemLibrary"><span class="hs-identifier hs-var">findSystemLibrary</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179169"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179135"><span class="hs-identifier hs-var">so_name</span></a></span><span>
</span><span id="line-1542"></span><span>     </span><span id="local-6989586621681179157"><span class="annot"><span class="annottext">tryGcc :: IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179157"><span class="hs-identifier hs-var hs-var">tryGcc</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179103"><span class="annot"><span class="annottext">search :: String -&gt; [String] -&gt; IO (Maybe String)
</span><a href="#local-6989586621681179103"><span class="hs-identifier hs-var hs-var">search</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; [String] -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Linker.html#searchForLibUsingGcc"><span class="hs-identifier hs-var">searchForLibUsingGcc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179151"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1543"></span><span>                         </span><span id="local-6989586621681179099"><span class="annot"><span class="annottext">dllpath :: IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179099"><span class="hs-identifier hs-var hs-var">dllpath</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; Maybe LibrarySpec)
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#DLLPath"><span class="hs-identifier hs-var">DLLPath</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1544"></span><span>                         </span><span id="local-6989586621681179098"><span class="annot"><span class="annottext">short :: IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179098"><span class="hs-identifier hs-var hs-var">short</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179099"><span class="hs-identifier hs-var">dllpath</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (Maybe String) -&gt; IO (Maybe LibrarySpec))
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; IO (Maybe String)
</span><a href="#local-6989586621681179103"><span class="hs-identifier hs-var">search</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179135"><span class="hs-identifier hs-var">so_name</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179167"><span class="hs-identifier hs-var">lib_dirs</span></a></span><span>
</span><span id="line-1545"></span><span>                         </span><span id="local-6989586621681179097"><span class="annot"><span class="annottext">full :: IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179097"><span class="hs-identifier hs-var hs-var">full</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179099"><span class="hs-identifier hs-var">dllpath</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (Maybe String) -&gt; IO (Maybe LibrarySpec))
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; IO (Maybe String)
</span><a href="#local-6989586621681179103"><span class="hs-identifier hs-var">search</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179134"><span class="hs-identifier hs-var">lib_so_name</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179167"><span class="hs-identifier hs-var">lib_dirs</span></a></span><span>
</span><span id="line-1546"></span><span>                         </span><span id="local-6989586621681179094"><span class="annot"><span class="annottext">gcc :: String -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179094"><span class="hs-identifier hs-var hs-var">gcc</span></a></span></span><span> </span><span id="local-6989586621681179093"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179093"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; Maybe LibrarySpec)
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#Archive"><span class="hs-identifier hs-var">Archive</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO (Maybe String) -&gt; IO (Maybe LibrarySpec))
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; IO (Maybe String)
</span><a href="#local-6989586621681179103"><span class="hs-identifier hs-var">search</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179093"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179167"><span class="hs-identifier hs-var">lib_dirs</span></a></span><span>
</span><span id="line-1547"></span><span>                         </span><span id="local-6989586621681179092"><span class="annot"><span class="annottext">files :: [String]
</span><a href="#local-6989586621681179092"><span class="hs-identifier hs-var hs-var">files</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179142"><span class="hs-identifier hs-var">import_libs</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179145"><span class="hs-identifier hs-var">arch_files</span></a></span><span>
</span><span id="line-1548"></span><span>                         </span><span id="local-6989586621681179091"><span class="annot"><span class="annottext">dlls :: [IO (Maybe LibrarySpec)]
</span><a href="#local-6989586621681179091"><span class="hs-identifier hs-var hs-var">dlls</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179098"><span class="hs-identifier hs-var">short</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179097"><span class="hs-identifier hs-var">full</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1549"></span><span>                         </span><span id="local-6989586621681179090"><span class="annot"><span class="annottext">archives :: [IO (Maybe LibrarySpec)]
</span><a href="#local-6989586621681179090"><span class="hs-identifier hs-var hs-var">archives</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO (Maybe LibrarySpec))
-&gt; [String] -&gt; [IO (Maybe LibrarySpec)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179094"><span class="hs-identifier hs-var">gcc</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179092"><span class="hs-identifier hs-var">files</span></a></span><span>
</span><span id="line-1550"></span><span>                     </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">[IO (Maybe LibrarySpec)] -&gt; IO (Maybe LibrarySpec)
forall a. [IO (Maybe a)] -&gt; IO (Maybe a)
</span><a href="#local-6989586621681179117"><span class="hs-identifier hs-var">apply</span></a></span><span> </span><span class="annot"><span class="annottext">([IO (Maybe LibrarySpec)] -&gt; IO (Maybe LibrarySpec))
-&gt; [IO (Maybe LibrarySpec)] -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span class="hs-cpp">
#if defined(CAN_LOAD_DLL)
</span><span>                          </span><span class="annot"><span class="annottext">[IO (Maybe LibrarySpec)]
</span><a href="#local-6989586621681179091"><span class="hs-identifier hs-var">dlls</span></a></span><span> </span><span class="annot"><span class="annottext">[IO (Maybe LibrarySpec)]
-&gt; [IO (Maybe LibrarySpec)] -&gt; [IO (Maybe LibrarySpec)]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="hs-cpp">
#endif
</span><span>                          </span><span class="annot"><span class="annottext">[IO (Maybe LibrarySpec)]
</span><a href="#local-6989586621681179090"><span class="hs-identifier hs-var">archives</span></a></span><span>
</span><span id="line-1555"></span><span>     </span><span id="local-6989586621681179161"><span class="annot"><span class="annottext">tryImpLib :: Bool -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179161"><span class="hs-identifier hs-var hs-var">tryImpLib</span></a></span></span><span> </span><span id="local-6989586621681179088"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179088"><span class="hs-identifier hs-var">re</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="#local-6989586621681179131"><span class="hs-identifier hs-var">os</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1556"></span><span>                       </span><span class="annot"><span class="annottext">OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#OSMinGW32"><span class="hs-identifier hs-var">OSMinGW32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1557"></span><span>                        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179086"><span class="annot"><span class="annottext">dirs' :: [String]
</span><a href="#local-6989586621681179086"><span class="hs-identifier hs-var hs-var">dirs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179088"><span class="hs-identifier hs-var">re</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179163"><span class="hs-identifier hs-var">user</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179167"><span class="hs-identifier hs-var">lib_dirs</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179166"><span class="hs-identifier hs-var">gcc_dirs</span></a></span><span>
</span><span id="line-1558"></span><span>                            </span><span id="local-6989586621681179083"><span class="annot"><span class="annottext">implib :: String -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179083"><span class="hs-identifier hs-var hs-var">implib</span></a></span></span><span> </span><span id="local-6989586621681179082"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179082"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; Maybe LibrarySpec)
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; LibrarySpec) -&gt; Maybe String -&gt; Maybe LibrarySpec
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#Archive"><span class="hs-identifier hs-var">Archive</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO (Maybe String) -&gt; IO (Maybe LibrarySpec))
-&gt; IO (Maybe String) -&gt; IO (Maybe LibrarySpec)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1559"></span><span>                                            </span><span class="annot"><span class="annottext">[String] -&gt; String -&gt; IO (Maybe String)
</span><a href="../../directory/src/System.Directory.html#findFile"><span class="hs-identifier hs-var">findFile</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179086"><span class="hs-identifier hs-var">dirs'</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179082"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1560"></span><span>                        </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">[IO (Maybe LibrarySpec)] -&gt; IO (Maybe LibrarySpec)
forall a. [IO (Maybe a)] -&gt; IO (Maybe a)
</span><a href="#local-6989586621681179117"><span class="hs-identifier hs-var">apply</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; IO (Maybe LibrarySpec))
-&gt; [String] -&gt; [IO (Maybe LibrarySpec)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; IO (Maybe LibrarySpec)
</span><a href="#local-6989586621681179083"><span class="hs-identifier hs-var">implib</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179142"><span class="hs-identifier hs-var">import_libs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1561"></span><span>                       </span><span class="annot"><span class="annottext">OS
</span><span class="hs-identifier">_</span></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe LibrarySpec -&gt; IO (Maybe LibrarySpec)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe LibrarySpec
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1562"></span><span>
</span><span id="line-1563"></span><span>     </span><span class="hs-comment">-- TH Makes use of the interpreter so this failure is not obvious.</span><span>
</span><span id="line-1564"></span><span>     </span><span class="hs-comment">-- So we are nice and warn/inform users why we fail before we do.</span><span>
</span><span id="line-1565"></span><span>     </span><span class="hs-comment">-- But only for haskell libraries, as C libraries don't have a</span><span>
</span><span id="line-1566"></span><span>     </span><span class="hs-comment">-- profiling/non-profiling distinction to begin with.</span><span>
</span><span id="line-1567"></span><span>     </span><span id="local-6989586621681179156"><span class="annot"><span class="annottext">assumeDll :: IO LibrarySpec
</span><a href="#local-6989586621681179156"><span class="hs-identifier hs-var hs-var">assumeDll</span></a></span></span><span>
</span><span id="line-1568"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179168"><span class="hs-identifier hs-var">is_hs</span></a></span><span>
</span><span id="line-1569"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179155"><span class="hs-identifier hs-var">loading_dynamic_hs_libs</span></a></span><span>
</span><span id="line-1570"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Interp -&gt; Bool
</span><a href="GHC.Runtime.Interpreter.html#interpreterProfiled"><span class="hs-identifier hs-var">interpreterProfiled</span></a></span><span> </span><span class="annot"><span class="annottext">Interp
</span><a href="#local-6989586621681179150"><span class="hs-identifier hs-var">interp</span></a></span><span>
</span><span id="line-1571"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1572"></span><span>          </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#warningMsg"><span class="hs-identifier hs-var">warningMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179151"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1573"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Interpreter failed to load profiled static library&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'.'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-1574"></span><span>              </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; \tTrying dynamic library instead. If this fails try to rebuild&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-1575"></span><span>              </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;libraries with profiling support.&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1576"></span><span>          </span><span class="annot"><span class="annottext">LibrarySpec -&gt; IO LibrarySpec
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#DLL"><span class="hs-identifier hs-var">DLL</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1577"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LibrarySpec -&gt; IO LibrarySpec
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; LibrarySpec
</span><a href="GHC.Runtime.Linker.html#DLL"><span class="hs-identifier hs-var">DLL</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179165"><span class="hs-identifier hs-var">lib</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1578"></span><span>     </span><span class="hs-keyword">infixr</span><span> </span><span class="annot"><a href="#local-6989586621681179162"><span class="hs-operator hs-type">`orElse`</span></a></span><span>
</span><span id="line-1579"></span><span>     </span><span id="local-6989586621681179073"><span class="annot"><span class="annottext">m (Maybe b)
</span><a href="#local-6989586621681179073"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621681179162"><span class="annot"><span class="annottext">orElse :: m (Maybe b) -&gt; m b -&gt; m b
</span><a href="#local-6989586621681179162"><span class="hs-operator hs-var hs-var">`orElse`</span></a></span></span><span> </span><span id="local-6989586621681179072"><span class="annot"><span class="annottext">m b
</span><a href="#local-6989586621681179072"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m (Maybe b)
</span><a href="#local-6989586621681179073"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">m (Maybe b) -&gt; (Maybe b -&gt; m b) -&gt; m b
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">m b -&gt; (b -&gt; m b) -&gt; Maybe b -&gt; m b
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">m b
</span><a href="#local-6989586621681179072"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; m b
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>
</span><span id="line-1580"></span><span>
</span><span id="line-1581"></span><span>     </span><span id="local-6989586621681180417"><span class="annot"><a href="#local-6989586621681179117"><span class="hs-identifier hs-type">apply</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681180417"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681180417"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1582"></span><span>     </span><span id="local-6989586621681179117"><span class="annot"><span class="annottext">apply :: forall a. [IO (Maybe a)] -&gt; IO (Maybe a)
</span><a href="#local-6989586621681179117"><span class="hs-identifier hs-var hs-var">apply</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IO (Maybe a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1583"></span><span>     </span><span class="annot"><a href="#local-6989586621681179117"><span class="hs-identifier hs-var">apply</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681179067"><span class="annot"><span class="annottext">IO (Maybe a)
</span><a href="#local-6989586621681179067"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179066"><span class="annot"><span class="annottext">[IO (Maybe a)]
</span><a href="#local-6989586621681179066"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681179065"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621681179065"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (Maybe a)
</span><a href="#local-6989586621681179067"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1584"></span><span>                       </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621681179065"><span class="hs-identifier hs-var">x'</span></a></span><span>
</span><span id="line-1585"></span><span>                          </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IO (Maybe a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621681179065"><span class="hs-identifier hs-var">x'</span></a></span><span>
</span><span id="line-1586"></span><span>                          </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[IO (Maybe a)] -&gt; IO (Maybe a)
forall a. [IO (Maybe a)] -&gt; IO (Maybe a)
</span><a href="#local-6989586621681179117"><span class="hs-identifier hs-var">apply</span></a></span><span> </span><span class="annot"><span class="annottext">[IO (Maybe a)]
</span><a href="#local-6989586621681179066"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1587"></span><span>
</span><span id="line-1588"></span><span>     </span><span id="local-6989586621681179136"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681179136"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179151"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1589"></span><span>     </span><span id="local-6989586621681179132"><span class="annot"><span class="annottext">arch :: Arch
</span><a href="#local-6989586621681179132"><span class="hs-identifier hs-var hs-var">arch</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformArch"><span class="hs-identifier hs-var">platformArch</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179136"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-1590"></span><span>     </span><span id="local-6989586621681179131"><span class="annot"><span class="annottext">os :: OS
</span><a href="#local-6989586621681179131"><span class="hs-identifier hs-var hs-var">os</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformOS"><span class="hs-identifier hs-var">platformOS</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681179136"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-1591"></span><span>
</span><span id="line-1592"></span><span class="annot"><a href="GHC.Runtime.Linker.html#searchForLibUsingGcc"><span class="hs-identifier hs-type">searchForLibUsingGcc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1593"></span><span id="searchForLibUsingGcc"><span class="annot"><span class="annottext">searchForLibUsingGcc :: DynFlags -&gt; String -&gt; [String] -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Linker.html#searchForLibUsingGcc"><span class="hs-identifier hs-var hs-var">searchForLibUsingGcc</span></a></span></span><span> </span><span id="local-6989586621681179062"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179062"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681179061"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179061"><span class="hs-identifier hs-var">so</span></a></span></span><span> </span><span id="local-6989586621681179060"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179060"><span class="hs-identifier hs-var">dirs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1594"></span><span>   </span><span class="hs-comment">-- GCC does not seem to extend the library search path (using -L) when using</span><span>
</span><span id="line-1595"></span><span>   </span><span class="hs-comment">-- --print-file-name. So instead pass it a new base location.</span><span>
</span><span id="line-1596"></span><span>   </span><span id="local-6989586621681179059"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179059"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [Option] -&gt; IO String
</span><a href="GHC.SysTools.Tasks.html#askLd"><span class="hs-identifier hs-var">askLd</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179062"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; Option) -&gt; [String] -&gt; [Option]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#FileOption"><span class="hs-identifier hs-var">FileOption</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-B&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179060"><span class="hs-identifier hs-var">dirs</span></a></span><span>
</span><span id="line-1597"></span><span>                          </span><span class="annot"><span class="annottext">[Option] -&gt; [Option] -&gt; [Option]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;--print-file-name&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179061"><span class="hs-identifier hs-var">so</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1598"></span><span>   </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179057"><span class="annot"><span class="annottext">file :: String
</span><a href="#local-6989586621681179057"><span class="hs-identifier hs-var hs-var">file</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String]
</span><a href="../../base/src/Data.OldList.html#lines"><span class="hs-identifier hs-var">lines</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179059"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1599"></span><span>                </span><span class="hs-special">[</span><span class="hs-special">]</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-1600"></span><span>                </span><span id="local-6989586621681179055"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179055"><span class="hs-identifier hs-var">l</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[String]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179055"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1601"></span><span>   </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179057"><span class="hs-identifier hs-var">file</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179061"><span class="hs-identifier hs-var">so</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1602"></span><span>      </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; IO (Maybe String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1603"></span><span>      </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681179054"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179054"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO Bool
</span><a href="../../directory/src/System.Directory.html#doesFileExist"><span class="hs-identifier hs-var">doesFileExist</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179057"><span class="hs-identifier hs-var">file</span></a></span><span> </span><span class="hs-comment">-- file could be a folder (see #16063)</span><span>
</span><span id="line-1604"></span><span>              </span><span class="annot"><span class="annottext">Maybe String -&gt; IO (Maybe String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681179054"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe String
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179057"><span class="hs-identifier hs-var">file</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1605"></span><span>
</span><span id="line-1606"></span><span class="hs-comment">-- | Retrieve the list of search directory GCC and the System use to find</span><span>
</span><span id="line-1607"></span><span class="hs-comment">--   libraries and components. See Note [Fork/Exec Windows].</span><span>
</span><span id="line-1608"></span><span class="annot"><a href="GHC.Runtime.Linker.html#getGCCPaths"><span class="hs-identifier hs-type">getGCCPaths</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#OS"><span class="hs-identifier hs-type">OS</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1609"></span><span id="getGCCPaths"><span class="annot"><span class="annottext">getGCCPaths :: DynFlags -&gt; OS -&gt; IO [String]
</span><a href="GHC.Runtime.Linker.html#getGCCPaths"><span class="hs-identifier hs-var hs-var">getGCCPaths</span></a></span></span><span> </span><span id="local-6989586621681179053"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179053"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681179052"><span class="annot"><span class="annottext">OS
</span><a href="#local-6989586621681179052"><span class="hs-identifier hs-var">os</span></a></span></span><span>
</span><span id="line-1610"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="#local-6989586621681179052"><span class="hs-identifier hs-var">os</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1611"></span><span>      </span><span class="annot"><span class="annottext">OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#OSMinGW32"><span class="hs-identifier hs-var">OSMinGW32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1612"></span><span>        </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681179051"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179051"><span class="hs-identifier hs-var">gcc_dirs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO [String]
</span><a href="GHC.Runtime.Linker.html#getGccSearchDirectory"><span class="hs-identifier hs-var">getGccSearchDirectory</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179053"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;libraries&quot;</span></span><span>
</span><span id="line-1613"></span><span>           </span><span id="local-6989586621681179049"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179049"><span class="hs-identifier hs-var">sys_dirs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO [String]
</span><a href="GHC.Runtime.Linker.html#getSystemDirectories"><span class="hs-identifier hs-var">getSystemDirectories</span></a></span><span>
</span><span id="line-1614"></span><span>           </span><span class="annot"><span class="annottext">[String] -&gt; IO [String]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; IO [String]) -&gt; [String] -&gt; IO [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String]
forall a. Eq a =&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#nub"><span class="hs-identifier hs-var">nub</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String]) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179051"><span class="hs-identifier hs-var">gcc_dirs</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179049"><span class="hs-identifier hs-var">sys_dirs</span></a></span><span>
</span><span id="line-1615"></span><span>      </span><span class="annot"><span class="annottext">OS
</span><span class="hs-identifier">_</span></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; IO [String]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1616"></span><span>
</span><span id="line-1617"></span><span class="hs-comment">-- | Cache for the GCC search directories as this can't easily change</span><span>
</span><span id="line-1618"></span><span class="hs-comment">--   during an invocation of GHC. (Maybe with some env. variable but we'll)</span><span>
</span><span id="line-1619"></span><span class="hs-comment">--   deal with that highly unlikely scenario then.</span><span>
</span><span id="line-1620"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#gccSearchDirCache"><span class="hs-pragma hs-type">gccSearchDirCache</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1621"></span><span class="annot"><a href="GHC.Runtime.Linker.html#gccSearchDirCache"><span class="hs-identifier hs-type">gccSearchDirCache</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1622"></span><span id="gccSearchDirCache"><span class="annot"><span class="annottext">gccSearchDirCache :: IORef [(String, [String])]
</span><a href="GHC.Runtime.Linker.html#gccSearchDirCache"><span class="hs-identifier hs-var hs-var">gccSearchDirCache</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (IORef [(String, [String])]) -&gt; IORef [(String, [String])]
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier hs-var">unsafePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (IORef [(String, [String])]) -&gt; IORef [(String, [String])])
-&gt; IO (IORef [(String, [String])]) -&gt; IORef [(String, [String])]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, [String])] -&gt; IO (IORef [(String, [String])])
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1623"></span><span>
</span><span id="line-1624"></span><span class="hs-comment">-- Note [Fork/Exec Windows]</span><span>
</span><span id="line-1625"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-1626"></span><span class="hs-comment">-- fork/exec is expensive on Windows, for each time we ask GCC for a library we</span><span>
</span><span id="line-1627"></span><span class="hs-comment">-- have to eat the cost of af least 3 of these: gcc -&gt; real_gcc -&gt; cc1.</span><span>
</span><span id="line-1628"></span><span class="hs-comment">-- So instead get a list of location that GCC would search and use findDirs</span><span>
</span><span id="line-1629"></span><span class="hs-comment">-- which hopefully is written in an optimized mannor to take advantage of</span><span>
</span><span id="line-1630"></span><span class="hs-comment">-- caching. At the very least we remove the overhead of the fork/exec and waits</span><span>
</span><span id="line-1631"></span><span class="hs-comment">-- which dominate a large percentage of startup time on Windows.</span><span>
</span><span id="line-1632"></span><span class="annot"><a href="GHC.Runtime.Linker.html#getGccSearchDirectory"><span class="hs-identifier hs-type">getGccSearchDirectory</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1633"></span><span id="getGccSearchDirectory"><span class="annot"><span class="annottext">getGccSearchDirectory :: DynFlags -&gt; String -&gt; IO [String]
</span><a href="GHC.Runtime.Linker.html#getGccSearchDirectory"><span class="hs-identifier hs-var hs-var">getGccSearchDirectory</span></a></span></span><span> </span><span id="local-6989586621681179044"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179044"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681179043"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179043"><span class="hs-identifier hs-var">key</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1634"></span><span>    </span><span id="local-6989586621681179042"><span class="annot"><span class="annottext">[(String, [String])]
</span><a href="#local-6989586621681179042"><span class="hs-identifier hs-var">cache</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IORef [(String, [String])] -&gt; IO [(String, [String])]
forall a. IORef a -&gt; IO a
</span><a href="../../base/src/GHC.IORef.html#readIORef"><span class="hs-identifier hs-var">readIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef [(String, [String])]
</span><a href="GHC.Runtime.Linker.html#gccSearchDirCache"><span class="hs-identifier hs-var">gccSearchDirCache</span></a></span><span>
</span><span id="line-1635"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; [(String, [String])] -&gt; Maybe [String]
forall a b. Eq a =&gt; a -&gt; [(a, b)] -&gt; Maybe b
</span><a href="../../base/src/GHC.List.html#lookup"><span class="hs-identifier hs-var">lookup</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179043"><span class="hs-identifier hs-var">key</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, [String])]
</span><a href="#local-6989586621681179042"><span class="hs-identifier hs-var">cache</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1636"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179039"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179039"><span class="hs-identifier hs-var">x</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; IO [String]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179039"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1637"></span><span>      </span><span class="annot"><span class="annottext">Maybe [String]
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1638"></span><span>        </span><span id="local-6989586621681179038"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179038"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [Option] -&gt; IO String
</span><a href="GHC.SysTools.Tasks.html#askLd"><span class="hs-identifier hs-var">askLd</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681179044"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; Option
</span><a href="GHC.Utils.CliOption.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;--print-search-dirs&quot;</span></span><span class="hs-special">]</span><span>
</span><span id="line-1639"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179037"><span class="annot"><span class="annottext">line :: String
</span><a href="#local-6989586621681179037"><span class="hs-identifier hs-var hs-var">line</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; String
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179038"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-1640"></span><span>            </span><span id="local-6989586621681179035"><span class="annot"><span class="annottext">name :: String
</span><a href="#local-6989586621681179035"><span class="hs-identifier hs-var hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179043"><span class="hs-identifier hs-var">key</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: =&quot;</span></span><span>
</span><span id="line-1641"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179037"><span class="hs-identifier hs-var">line</span></a></span><span>
</span><span id="line-1642"></span><span>          </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; IO [String]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1643"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179034"><span class="annot"><span class="annottext">val :: [String]
</span><a href="#local-6989586621681179034"><span class="hs-identifier hs-var hs-var">val</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String]
</span><a href="#local-6989586621681179033"><span class="hs-identifier hs-var">split</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; [String]) -&gt; String -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="#local-6989586621681179032"><span class="hs-identifier hs-var">find</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179035"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179037"><span class="hs-identifier hs-var">line</span></a></span><span>
</span><span id="line-1644"></span><span>                  </span><span id="local-6989586621681179031"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179031"><span class="hs-identifier hs-var">dirs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO Bool) -&gt; [String] -&gt; IO [String]
forall (m :: * -&gt; *) a.
Applicative m =&gt;
(a -&gt; m Bool) -&gt; [a] -&gt; m [a]
</span><a href="../../base/src/Control.Monad.html#filterM"><span class="hs-identifier hs-var">filterM</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; IO Bool
</span><a href="../../directory/src/System.Directory.html#doesDirectoryExist"><span class="hs-identifier hs-var">doesDirectoryExist</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179034"><span class="hs-identifier hs-var">val</span></a></span><span>
</span><span id="line-1645"></span><span>                  </span><span class="annot"><span class="annottext">IORef [(String, [String])]
-&gt; ([(String, [String])] -&gt; [(String, [String])]) -&gt; IO ()
forall a. IORef a -&gt; (a -&gt; a) -&gt; IO ()
</span><a href="../../base/src/Data.IORef.html#modifyIORef%27"><span class="hs-identifier hs-var">modifyIORef'</span></a></span><span> </span><span class="annot"><span class="annottext">IORef [(String, [String])]
</span><a href="GHC.Runtime.Linker.html#gccSearchDirCache"><span class="hs-identifier hs-var">gccSearchDirCache</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179043"><span class="hs-identifier hs-var">key</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179031"><span class="hs-identifier hs-var">dirs</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">(String, [String]) -&gt; [(String, [String])] -&gt; [(String, [String])]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span>
</span><span id="line-1646"></span><span>                  </span><span class="annot"><span class="annottext">[String] -&gt; IO [String]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179034"><span class="hs-identifier hs-var">val</span></a></span><span>
</span><span id="line-1647"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="#local-6989586621681179033"><span class="hs-identifier hs-type">split</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1648"></span><span>            </span><span id="local-6989586621681179033"><span class="annot"><span class="annottext">split :: String -&gt; [String]
</span><a href="#local-6989586621681179033"><span class="hs-identifier hs-var hs-var">split</span></a></span></span><span> </span><span id="local-6989586621681179027"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179027"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">';'</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179027"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1649"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621681179025"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179025"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179025"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1650"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621681179024"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179024"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179023"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179023"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179024"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String]
</span><a href="#local-6989586621681179033"><span class="hs-identifier hs-var">split</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179023"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1651"></span><span>
</span><span id="line-1652"></span><span>            </span><span class="annot"><a href="#local-6989586621681179032"><span class="hs-identifier hs-type">find</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1653"></span><span>            </span><span id="local-6989586621681179032"><span class="annot"><span class="annottext">find :: String -&gt; String -&gt; String
</span><a href="#local-6989586621681179032"><span class="hs-identifier hs-var hs-var">find</span></a></span></span><span> </span><span id="local-6989586621681179022"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179022"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621681179021"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179021"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681179020"><span class="annot"><span class="annottext">lst :: [String]
</span><a href="#local-6989586621681179020"><span class="hs-identifier hs-var hs-var">lst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String]
</span><a href="../../base/src/Data.OldList.html#lines"><span class="hs-identifier hs-var">lines</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179021"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1654"></span><span>                           </span><span id="local-6989586621681179018"><span class="annot"><span class="annottext">val :: [String]
</span><a href="#local-6989586621681179018"><span class="hs-identifier hs-var hs-var">val</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Bool) -&gt; [String] -&gt; [String]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179022"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; [a] -&gt; [a] -&gt; Bool
</span><a href="../../base/src/Data.OldList.html#isPrefixOf"><span class="hs-operator hs-var">`isPrefixOf`</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179020"><span class="hs-identifier hs-var">lst</span></a></span><span>
</span><span id="line-1655"></span><span>                       </span><span class="hs-keyword">in</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179018"><span class="hs-identifier hs-var">val</span></a></span><span>
</span><span id="line-1656"></span><span>                             </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1657"></span><span>                             </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'='</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; String
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#head"><span class="hs-identifier hs-var">head</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179018"><span class="hs-identifier hs-var">val</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1658"></span><span>                                     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1659"></span><span>                                     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179016"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179016"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179016"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1660"></span><span>
</span><span id="line-1661"></span><span class="hs-comment">-- | Get a list of system search directories, this to alleviate pressure on</span><span>
</span><span id="line-1662"></span><span class="hs-comment">-- the findSysDll function.</span><span>
</span><span id="line-1663"></span><span class="annot"><a href="GHC.Runtime.Linker.html#getSystemDirectories"><span class="hs-identifier hs-type">getSystemDirectories</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span class="hs-cpp">
#if defined(mingw32_HOST_OS)
</span><span id="getSystemDirectories"><span class="annot"><span class="annottext">getSystemDirectories :: IO [String]
</span><a href="GHC.Runtime.Linker.html#getSystemDirectories"><span class="hs-identifier hs-var hs-var">getSystemDirectories</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; [String]) -&gt; IO String -&gt; IO [String]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IO String
</span><a href="../../Win32/src/System.Win32.Info.html#getSystemDirectory"><span class="hs-identifier hs-var">getSystemDirectory</span></a></span><span class="hs-cpp">
#else
</span><span class="hs-identifier">getSystemDirectories</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1670"></span><span class="hs-comment">-- | Merge the given list of paths with those in the environment variable</span><span>
</span><span id="line-1671"></span><span class="hs-comment">--   given. If the variable does not exist then just return the identity.</span><span>
</span><span id="line-1672"></span><span class="annot"><a href="GHC.Runtime.Linker.html#addEnvPaths"><span class="hs-identifier hs-type">addEnvPaths</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1673"></span><span id="addEnvPaths"><span class="annot"><span class="annottext">addEnvPaths :: String -&gt; [String] -&gt; IO [String]
</span><a href="GHC.Runtime.Linker.html#addEnvPaths"><span class="hs-identifier hs-var hs-var">addEnvPaths</span></a></span></span><span> </span><span id="local-6989586621681179015"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179015"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span id="local-6989586621681179014"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179014"><span class="hs-identifier hs-var">list</span></a></span></span><span>
</span><span id="line-1674"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-comment">-- According to POSIX (chapter 8.3) a zero-length prefix means current</span><span>
</span><span id="line-1675"></span><span>       </span><span class="hs-comment">-- working directory. Replace empty strings in the env variable with</span><span>
</span><span id="line-1676"></span><span>       </span><span class="hs-comment">-- `working_dir` (see also #14695).</span><span>
</span><span id="line-1677"></span><span>       </span><span id="local-6989586621681179013"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179013"><span class="hs-identifier hs-var">working_dir</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO String
</span><a href="../../directory/src/System.Directory.html#getCurrentDirectory"><span class="hs-identifier hs-var">getCurrentDirectory</span></a></span><span>
</span><span id="line-1678"></span><span>       </span><span id="local-6989586621681179011"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179011"><span class="hs-identifier hs-var">values</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO (Maybe String)
</span><a href="../../base/src/System.Environment.html#lookupEnv"><span class="hs-identifier hs-var">lookupEnv</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179015"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1679"></span><span>       </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681179011"><span class="hs-identifier hs-var">values</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1680"></span><span>         </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; IO [String]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179014"><span class="hs-identifier hs-var">list</span></a></span><span>
</span><span id="line-1681"></span><span>         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681179010"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179010"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; IO [String]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; IO [String]) -&gt; [String] -&gt; IO [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179014"><span class="hs-identifier hs-var">list</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; [String]
</span><a href="#local-6989586621681179009"><span class="hs-identifier hs-var">splitEnv</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179013"><span class="hs-identifier hs-var">working_dir</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179010"><span class="hs-identifier hs-var">arr</span></a></span><span>
</span><span id="line-1682"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-1683"></span><span>      </span><span class="annot"><a href="#local-6989586621681179009"><span class="hs-identifier hs-type">splitEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1684"></span><span>      </span><span id="local-6989586621681179009"><span class="annot"><span class="annottext">splitEnv :: String -&gt; String -&gt; [String]
</span><a href="#local-6989586621681179009"><span class="hs-identifier hs-var hs-var">splitEnv</span></a></span></span><span> </span><span id="local-6989586621681179008"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179008"><span class="hs-identifier hs-var">working_dir</span></a></span></span><span> </span><span id="local-6989586621681179007"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179007"><span class="hs-identifier hs-var">value</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1685"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621681179006"><span class="hs-identifier hs-var">envListSep</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179007"><span class="hs-identifier hs-var">value</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1686"></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621681179005"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179005"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1687"></span><span>            </span><span class="hs-special">[</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179005"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179008"><span class="hs-identifier hs-var">working_dir</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179005"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1688"></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621681179004"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179004"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681179003"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179003"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1689"></span><span>            </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179004"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179008"><span class="hs-identifier hs-var">working_dir</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179004"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; [String]
</span><a href="#local-6989586621681179009"><span class="hs-identifier hs-var">splitEnv</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179008"><span class="hs-identifier hs-var">working_dir</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179003"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-cpp">
#if defined(mingw32_HOST_OS)
</span><span>      </span><span id="local-6989586621681179006"><span class="annot"><span class="annottext">envListSep :: Char
</span><a href="#local-6989586621681179006"><span class="hs-identifier hs-var hs-var">envListSep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">';'</span></span><span class="hs-cpp">
#else
</span><span>      </span><span class="hs-identifier">envListSep</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-char">':'</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1696"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-1697"></span><span class="hs-comment">-- Loading a dynamic library (dlopen()-ish on Unix, LoadLibrary-ish on Win32)</span><span>
</span><span id="line-1698"></span><span>
</span><span id="line-1699"></span><span class="hs-comment">{-
Note [macOS Big Sur dynamic libraries]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

macOS Big Sur makes the following change to how frameworks are shipped
with the OS:

&gt; New in macOS Big Sur 11 beta, the system ships with a built-in
&gt; dynamic linker cache of all system-provided libraries.  As part of
&gt; this change, copies of dynamic libraries are no longer present on
&gt; the filesystem.  Code that attempts to check for dynamic library
&gt; presence by looking for a file at a path or enumerating a directory
&gt; will fail.  Instead, check for library presence by attempting to
&gt; dlopen() the path, which will correctly check for the library in the
&gt; cache. (62986286)

(https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11-beta-release-notes/)

Therefore, the previous method of checking whether a library exists
before attempting to load it makes GHC.Runtime.Linker.loadFramework
fail to find frameworks installed at /System/Library/Frameworks.
Instead, any attempt to load a framework at runtime, such as by
passing -framework OpenGL to runghc or running code loading such a
framework with GHCi, fails with a 'not found' message.

GHC.Runtime.Linker.loadFramework now opportunistically loads the
framework libraries without checking for their existence first,
failing only if all attempts to load a given framework from any of the
various possible locations fail.  See also #18446, which this change
addresses.
-}</span><span>
</span><span id="line-1730"></span><span>
</span><span id="line-1731"></span><span class="hs-comment">-- Darwin / MacOS X only: load a framework</span><span>
</span><span id="line-1732"></span><span class="hs-comment">-- a framework is a dynamic library packaged inside a directory of the same</span><span>
</span><span id="line-1733"></span><span class="hs-comment">-- name. They are searched for in different paths than normal libraries.</span><span>
</span><span id="line-1734"></span><span class="annot"><a href="GHC.Runtime.Linker.html#loadFramework"><span class="hs-identifier hs-type">loadFramework</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1735"></span><span id="loadFramework"><span class="annot"><span class="annottext">loadFramework :: HscEnv -&gt; [String] -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Linker.html#loadFramework"><span class="hs-identifier hs-var hs-var">loadFramework</span></a></span></span><span> </span><span id="local-6989586621681179002"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179002"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681179001"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179001"><span class="hs-identifier hs-var">extraPaths</span></a></span></span><span> </span><span id="local-6989586621681179000"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179000"><span class="hs-identifier hs-var">rootname</span></a></span></span><span>
</span><span id="line-1736"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681178999"><span class="annot"><span class="annottext">Either IOException String
</span><a href="#local-6989586621681178999"><span class="hs-identifier hs-var">either_dir</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO String -&gt; IO (Either IOException String)
forall a. IO a -&gt; IO (Either IOException a)
</span><a href="GHC.Utils.Exception.html#tryIO"><span class="hs-identifier hs-var">tryIO</span></a></span><span> </span><span class="annot"><span class="annottext">IO String
</span><a href="../../directory/src/System.Directory.html#getHomeDirectory"><span class="hs-identifier hs-var">getHomeDirectory</span></a></span><span>
</span><span id="line-1737"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681178996"><span class="annot"><span class="annottext">homeFrameworkPath :: [String]
</span><a href="#local-6989586621681178996"><span class="hs-identifier hs-var hs-var">homeFrameworkPath</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Either IOException String
</span><a href="#local-6989586621681178999"><span class="hs-identifier hs-var">either_dir</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1738"></span><span>                                  </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span class="annot"><span class="annottext">IOException
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1739"></span><span>                                  </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621681178995"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178995"><span class="hs-identifier hs-var">dir</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178995"><span class="hs-identifier hs-var">dir</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C%2F%3E"><span class="hs-operator hs-var">&lt;/&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Library/Frameworks&quot;</span></span><span class="hs-special">]</span><span>
</span><span id="line-1740"></span><span>              </span><span id="local-6989586621681178994"><span class="annot"><span class="annottext">ps :: [String]
</span><a href="#local-6989586621681178994"><span class="hs-identifier hs-var hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681179001"><span class="hs-identifier hs-var">extraPaths</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681178996"><span class="hs-identifier hs-var">homeFrameworkPath</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681178993"><span class="hs-identifier hs-var">defaultFrameworkPaths</span></a></span><span>
</span><span id="line-1741"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681178992"><span class="annot"><span class="annottext">Maybe [String]
</span><a href="#local-6989586621681178992"><span class="hs-identifier hs-var">errs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; IO (Maybe [String])
</span><a href="#local-6989586621681178991"><span class="hs-identifier hs-var">findLoadDLL</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681178994"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1742"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; IO (Maybe String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; IO (Maybe String))
-&gt; Maybe String -&gt; IO (Maybe String)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; String) -&gt; Maybe [String] -&gt; Maybe String
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; String
forall a. [a] -&gt; [[a]] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#intercalate"><span class="hs-identifier hs-var">intercalate</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;, &quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe [String]
</span><a href="#local-6989586621681178992"><span class="hs-identifier hs-var">errs</span></a></span><span>
</span><span id="line-1743"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-1744"></span><span>   </span><span class="hs-keyword">where</span><span>
</span><span id="line-1745"></span><span>     </span><span id="local-6989586621681178990"><span class="annot"><span class="annottext">fwk_file :: String
</span><a href="#local-6989586621681178990"><span class="hs-identifier hs-var hs-var">fwk_file</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179000"><span class="hs-identifier hs-var">rootname</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;framework&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C%2F%3E"><span class="hs-operator hs-var">&lt;/&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681179000"><span class="hs-identifier hs-var">rootname</span></a></span><span>
</span><span id="line-1746"></span><span>
</span><span id="line-1747"></span><span>     </span><span class="hs-comment">-- sorry for the hardcoded paths, I hope they won't change anytime soon:</span><span>
</span><span id="line-1748"></span><span>     </span><span id="local-6989586621681178993"><span class="annot"><span class="annottext">defaultFrameworkPaths :: [String]
</span><a href="#local-6989586621681178993"><span class="hs-identifier hs-var hs-var">defaultFrameworkPaths</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;/Library/Frameworks&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;/System/Library/Frameworks&quot;</span></span><span class="hs-special">]</span><span>
</span><span id="line-1749"></span><span>
</span><span id="line-1750"></span><span>     </span><span class="hs-comment">-- Try to call loadDLL for each candidate path.</span><span>
</span><span id="line-1751"></span><span>     </span><span class="hs-comment">--</span><span>
</span><span id="line-1752"></span><span>     </span><span class="hs-comment">-- See Note [macOS Big Sur dynamic libraries]</span><span>
</span><span id="line-1753"></span><span>     </span><span id="local-6989586621681178991"><span class="annot"><span class="annottext">findLoadDLL :: [String] -&gt; [String] -&gt; IO (Maybe [String])
</span><a href="#local-6989586621681178991"><span class="hs-identifier hs-var hs-var">findLoadDLL</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621681178986"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681178986"><span class="hs-identifier hs-var">errs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1754"></span><span>       </span><span class="hs-comment">-- Tried all our known library paths, but dlopen()</span><span>
</span><span id="line-1755"></span><span>       </span><span class="hs-comment">-- has no built-in paths for frameworks: give up</span><span>
</span><span id="line-1756"></span><span>       </span><span class="annot"><span class="annottext">Maybe [String] -&gt; IO (Maybe [String])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe [String] -&gt; IO (Maybe [String]))
-&gt; Maybe [String] -&gt; IO (Maybe [String])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; Maybe [String]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681178986"><span class="hs-identifier hs-var">errs</span></a></span><span>
</span><span id="line-1757"></span><span>     </span><span class="annot"><a href="#local-6989586621681178991"><span class="hs-identifier hs-var">findLoadDLL</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681178985"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178985"><span class="hs-identifier hs-var">p</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681178984"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681178984"><span class="hs-identifier hs-var">ps</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681178983"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681178983"><span class="hs-identifier hs-var">errs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1758"></span><span>       </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681178982"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681178982"><span class="hs-identifier hs-var">dll</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; String -&gt; IO (Maybe String)
</span><a href="GHC.Runtime.Interpreter.html#loadDLL"><span class="hs-identifier hs-var">loadDLL</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681179002"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178985"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C%2F%3E"><span class="hs-operator hs-var">&lt;/&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178990"><span class="hs-identifier hs-var">fwk_file</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1759"></span><span>          </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621681178982"><span class="hs-identifier hs-var">dll</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1760"></span><span>              </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe [String] -&gt; IO (Maybe [String])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe [String]
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1761"></span><span>              </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681178981"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178981"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; IO (Maybe [String])
</span><a href="#local-6989586621681178991"><span class="hs-identifier hs-var">findLoadDLL</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681178984"><span class="hs-identifier hs-var">ps</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178985"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178981"><span class="hs-identifier hs-var">err</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681178983"><span class="hs-identifier hs-var">errs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1762"></span><span>          </span><span class="hs-special">}</span><span>
</span><span id="line-1763"></span><span>
</span><span id="line-1764"></span><span class="hs-comment">{- **********************************************************************

                Helper functions

  ********************************************************************* -}</span><span>
</span><span id="line-1769"></span><span>
</span><span id="line-1770"></span><span class="annot"><a href="GHC.Runtime.Linker.html#maybePutStr"><span class="hs-identifier hs-type">maybePutStr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1771"></span><span id="maybePutStr"><span class="annot"><span class="annottext">maybePutStr :: DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStr"><span class="hs-identifier hs-var hs-var">maybePutStr</span></a></span></span><span> </span><span id="local-6989586621681178980"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178980"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681178979"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178979"><span class="hs-identifier hs-var">s</span></a></span></span><span>
</span><span id="line-1772"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Int
</span><a href="GHC.Driver.Session.html#verbosity"><span class="hs-identifier hs-var hs-var">verbosity</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178980"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1773"></span><span>          </span><span class="annot"><span class="annottext">DynFlags -&gt; WarnReason -&gt; Severity -&gt; SrcSpan -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Driver.Session.html#putLogMsg"><span class="hs-identifier hs-var">putLogMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178980"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1774"></span><span>              </span><span class="annot"><span class="annottext">WarnReason
</span><a href="GHC.Driver.Flags.html#NoReason"><span class="hs-identifier hs-var">NoReason</span></a></span><span>
</span><span id="line-1775"></span><span>              </span><span class="annot"><span class="annottext">Severity
</span><a href="GHC.Utils.Error.html#SevInteractive"><span class="hs-identifier hs-var">SevInteractive</span></a></span><span>
</span><span id="line-1776"></span><span>              </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier hs-var">noSrcSpan</span></a></span><span>
</span><span id="line-1777"></span><span>              </span><span class="annot"><span class="annottext">(SDoc -&gt; IO ()) -&gt; SDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#withPprStyle"><span class="hs-identifier hs-var">withPprStyle</span></a></span><span> </span><span class="annot"><span class="annottext">PprStyle
</span><a href="GHC.Utils.Outputable.html#defaultUserStyle"><span class="hs-identifier hs-var">defaultUserStyle</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178979"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1778"></span><span>
</span><span id="line-1779"></span><span class="annot"><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-type">maybePutStrLn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1780"></span><span id="maybePutStrLn"><span class="annot"><span class="annottext">maybePutStrLn :: DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStrLn"><span class="hs-identifier hs-var hs-var">maybePutStrLn</span></a></span></span><span> </span><span id="local-6989586621681178975"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178975"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681178974"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178974"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#maybePutStr"><span class="hs-identifier hs-var">maybePutStr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178975"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681178974"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\n&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1781"></span></pre></body></html>